pixijs / layers

Separate the z-hierarchy of your scene tree from its canonical structure.
https://pixijs.io/layers/docs/
MIT License
224 stars 57 forks source link

Z-Index change has no effect #102

Open EpicDiceStudio opened 1 year ago

EpicDiceStudio commented 1 year ago

Hello,

I have the impression that the ZIndex property doesn't work at all.

No matter what value is set, it's the order of addition to the Stage that matters, not the ZIndex.

I thought it worked like this:

I tested with two groups, the first with a ZIndex of 20 and the second with a ZIndex of 1. The first should naturally be displayed above the first. Obviously, this isn't the case: I have to add the first layer to the stage last so that it appears in the foreground.

In my application, I use Pixi/Viewport, but I've tested it without and I get the same behavior.

I'm in Pixi v7, here's a Fork of an example (not in V7): https://replit.com/join/ytxdmaalua-pierrebouvet1

I've moved the editLayer so that it's added first, but when I change the ZIndex nothing happens. So I don't really understand the purpose of this property... In my application I need to be able to add/edit layers, which would require me to manually manage the order of the layers in the stage stack, is this normal?

ivanpopelyshev commented 1 year ago

zIndex works only inside one single group.

Group zIndex prop isnt used currently ) You can sort your layers by it manually