pixijs / layers

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

Masks prevent interactions regardless of layers/groups. #17

Closed namark closed 6 years ago

namark commented 6 years ago

I'm using the layers branch and I've got this very basic setup:

const stage = new PIXI.display.Stage();
stage.group.enableSort = true;

const overlay = new PIXI.display.Group(10, false);
stage.addChild(new PIXI.display.Layer(overlay));

If I set the parentGroup of a display object to overlay it works just fine visually, the object is rendered on top of anything else in the stage, but if the parent of that object has a mask, while still displayed correctly, the interactions don't work unless the object is within the bounds of the mask.

Seems like a pretty nasty problem since the decision is made before even getting to the object that has a parentGroup set https://github.com/pixijs/pixi-display/blob/25a2a0e06269c6fde4241308a54727bffb9405d2/src/InteractionManagerMixin.ts#L45 so I'm hoping that I just overlooked some easy way around this.

ivanpopelyshev commented 6 years ago

You are right, that's a bug. Its not easy to make interaction work with this, of course we'll need some adjustments ^_^ Working on it.

namark commented 6 years ago

Wow, you mean there is hope? Yaaay Thanks!

ivanpopelyshev commented 6 years ago

Ok, lets try new version, I made fast fix but its not complete, it doesnt handle masks of parent layer. Look in "bin" folder of this branch.

namark commented 6 years ago

Just tried it, seems to be working well for my use case, thanks for the quick fix!

ivanpopelyshev commented 6 years ago

Ok, i found one more issue with that, and just fixed it. Lets close this issue.