Closed SvDen closed 6 years ago
pixijs.io is not responding, cant check this thing now. can you host https://raw.githubusercontent.com/pixijs/pixi-display/layers/bin/pixi-layers.js somewhere else ?)
ok, so the general idea is that bunniesOdd does not have ANY children that are renderable, they all are rendered in layers. By assigning thing.parentGroup
or thing.parentLayer
you have to understand that thing
will be rendered inside the corresponding layer instead of its parent.
Accurately, thing
will appear in layer._sortedChildren
and layer
will render it.
Thus, your mask is applied to nothing.
Thank you for so fast response!
I understand it clearly, but don't understand how to fix this. Applying the mask on the each child don't looks like a best way...
You need things to be masked and there has to be things that are not masked between them, right?
I need a Container that will mask all its children regardless of theirs parentGroup.
masks and filters are supposed to be applied to layers. Why do you need that thing and how exactly do you think to implement without the plugin?
pixi-layers can do same things that user can. so if you cant imagine how exactly masks and filters pushed and popped and how elements are ordered inside the tree, plugin wont help you.
Why do you need that thing
I need this for sorting children between each other. Also I have a rectangle area that should not be crossed by neither of child. The only way that works is to assign mask to each children, I did it in the example with blue Bunny. I am just wondering if there is no other way,..
What if you assign mask to layer?
So I need to assign mask to all layers that could be used... I just wanted some way to inherit mask area from their direct parent, not display parent. Can't realize why that worked with an old pixi-display.
yep.
You were lucky that it worked in pixi-display. pixi-layers were made as a branch where dev can actually decide where to put masks, exactly.
The point is that masks are not inherited, mask is pushed when component starts rendering and popped when it ends.
Simple "inherit" there can affect performance, seriously.
Thank you very much for your help!
I've just migrated from pixi-display to pixi-layers and my masks become broken. Previously all I need to do is just applying Rectangle mask to Container with multiple children and all worked fine regardless of their displayGroups.
https://jsfiddle.net/SvDenys/2om9fn3s/
Now I can't understand how to do this. I made a fiddle from the bunny example. The most important here is this line:
bunniesOdd.mask = mask
Interactivity works fine, but displaying are not. Could you please help me?