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

mask.containsPoint is not a function when importing 'pixi-layers' #54

Closed Ilko89BG closed 4 years ago

Ilko89BG commented 4 years ago

Hello there, Without any code or any implementation - just when I import the package I get this error when hovering over a mask. Selection_006 Selection_005

Not going to use it for now, but just wanted to point out this issue.

Regards, Iliya Iliev

ivanpopelyshev commented 4 years ago

oh !@$# i forgot to modify this plugin after MaskData was introduced.

See this function? https://github.com/pixijs/pixi-layers/blob/master/src/LayersTreeSearch.ts#L40

That's how it is in pixi: https://github.com/pixijs/pixi.js/blob/dev/packages/interaction/src/TreeSearch.js#L87

I suggest to patch it and see if it works :

PIXI.display.LayersTreeSearch.prototype.recursiveFindHit = function(params) {
//...
// same as in pixi-layers bug with fix
}

I'll make new build tomorrow :) Is that ok?

Ilko89BG commented 4 years ago

oh !@$# i forgot to modify this plugin after MaskData was introduced.

See this function? https://github.com/pixijs/pixi-layers/blob/master/src/LayersTreeSearch.ts#L40

That's how it is in pixi: https://github.com/pixijs/pixi.js/blob/dev/packages/interaction/src/TreeSearch.js#L87

I suggest to patch it and see if it works :

PIXI.display.LayersTreeSearch.prototype.recursiveFindHit = function(params) {
//...
// same as in pixi-layers bug with fix
}

I'll make new build tomorrow :) Is that ok?

Perfectly fine, thanks again, Ivan. You are quite prompt! :)

Tried to patch it - however I find difficulties understanding how to properly find interactiveEvent.target - maybe I am just not understanding something - haven't read thoroughly the library - but will do that for sure!

Ilko89BG commented 4 years ago

Sorry if I am being pushy - but any updates on this? Or at least can you give me some pointers as to how to handle the issues I mentioned in the previous post.

ivanpopelyshev commented 4 years ago

Oh, i forgot it.

however I find difficulties understanding how to properly find interactiveEvent.target - maybe I am just not understanding something - haven't read thoroughly the library - but will do that for sure!

I dont understand what are you talking about. The goal is just to copy the method like it is in pixi-layers and fix particular line

if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point)))**

you dont have to port other changes.

Ilko89BG commented 4 years ago

Oh, i forgot it.

however I find difficulties understanding how to properly find interactiveEvent.target - maybe I am just not understanding something - haven't read thoroughly the library - but will do that for sure!

I dont understand what are you talking about. The goal is just to copy the method like it is in pixi-layers and fix particular line

if (!(displayObject._mask.containsPoint && displayObject._mask.containsPoint(point)))**

you dont have to port other changes.

Ok, got it! - Will try it out, thanks.

Ilko89BG commented 4 years ago

Yes, this doesn't throw the error - thanks again, Ivan!