pixijs/layers

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

Ilko89BG opened this issue · 6 comments

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

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?

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!

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.

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.

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.

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