So I understand that the selection.items is ordered by how the user selected or the order has no meaning (random) if selected by marquee. Is there a way to get the layers’ z-index in the document though?
We currently display a preview of the user’s selected layers (just the colors of two selected layers), but I can’t find a way to make it so that their bottom-most layer is always on the bottom. We’d like the preview to match how it looks in their document if possible.
@fookay you can traverse back to the selection’s parent like an artboard and get the list of the artboard’s children. This will return items in z order. Once you are at the artboard level, you can do something like this to check the order: