PIXI Events propagation bug with zOrder
edev2020 opened this issue · 2 comments
When you click over an sprite with bigger zOrder but that was drawn before the one with smaller zOrder the click will go to the sprite with smaller zOrder instead.
PIXI Layers Example (Bugged): https://www.pixiplayground.com/#/edit/0ycJnTLAu3lJu4RHq3Dee
PIXI Containers Example (Working fine): https://www.pixiplayground.com/#/edit/lL7_CdWFKhdzspEFjQN87
It looks like the PIXI native event system isn't respecting the PIXI Layers zOrder hierarchy.
I think no one actually implemented layers improvements for new events :) It worked for old ones. You can make a PR :)
I think no one actually implemented layers improvements for new events :) It worked for old ones. You can make a PR :)
I found a fix for now.
- Store the objects list in a object with data like name,zOrder and anything you need to use.
- Sort the object list by zOrder value in case the data is added dynamically and its not a static object.
- Execute the loop to draw all the objects.
So the order objects are drawn at first is what matters for the new EventSystem to work properly with PIXI Layers.