Jump to content

pixi-layers: .on(sort) callback and updateOrder


Zealot
 Share

Recommended Posts

I've been playing around with pixi-layers for a few days now and I've noticed 2 things:

  1. The layer.on("sort", ...) callback is being called continuously (on each tick if I had to guess).
  2. Each elements within layers have an updateOrder attribute that's continuously incrementing:

All of that lead me to believe that layers are being continuously re-sorted (I may be mistaken), and I was wondering what was the point of doing such thing? Wouldn't be better to listen for an element's zOrder to change? This behavior can be observed on the example files as well.

Link to comment
Share on other sites

layers are scanning whole tree every frame, and re-sort stuff, any other implmeentation could have big number of bugs :) Another trick is that in many cases you dont have to use layers sort, they are mostly used to conventionally move elements to other rendering containers.

Default pixi-v5 sort is better in that way - but its limited only to one container, you cant sort through tree.

I have custom layers version that actually takes care of all those changes, and even removes pixi canonical updateTransform() pass completely. Its too hard to publish it, people wont understand all those small triggers.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...