sort embedded layer by drawing order (fixes #7673)