pixijs / layers

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

Ability to reset parentGroup to null #64

Closed motla closed 3 years ago

motla commented 3 years ago

Hi,

I would like to make a PR that resets ._activeParentLayer to null when the user sets .parentGroup to null.

In fact:


var bunny = new PIXI.Sprite(...);
var my_group = new PIXI.display.Group(...);

console.log(bunny.parentGroup); // null
// bunny displays fine although bunny.parentGroup set to null by default

bunny.parentGroup = my_group;
// bunny displays fine when bunny.parentGroup set to my_group

bunny.parentGroup = null;
// bunny does not display anymore because bunny._activeParentLayer was not reset internally

bunny._activeParentLayer = null;
// bunny displays fine

🚀 I made a playground for you to test.

I looked at the code but how to implement this is not obvious to me. If you don't have the time to fix it, can you guide me how to implement this without breaking any functionality.

Thanks

ivanpopelyshev commented 3 years ago

fortunately, that bug was fixed in latest version :) i dont know how did i even miss that

try @pixi/layers