ChenXin Posted November 27, 2019 Share Posted November 27, 2019 (edited) I have two overlapped sibling sprites, and they are NOT nested. const spriteA = PIXI.Sprite.from(...) app.stage.addChild(spriteA) spriteA.interactive = true spriteA.on("pointerdown", () => {console.log("spriteA")}) const spriteB = PIXI.Sprite.from(...) app.stage.addChild(spriteB) spriteB.interactive = true spriteB.on("pointerdown", () => {console.log("spriteB")}) What I want to achieve: When I click the overlapped area, I want the event on both spriteA and spriteB fired. I leave spriteA and spriteB NOT nested on purpose, due to some reason they cannot be nested. Edited November 27, 2019 by ChenXin ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 27, 2019 Share Posted November 27, 2019 (edited) This behaviour is not included in pixi package. However, PixiJS team certainly does not have enough exp to implement everything that user wants. Since v5.2.0, you can override interaction behaviour. Its possible by overriding TreeSearch. https://github.com/pixijs/pixi.js/tree/dev/packages/interaction/src "renderer.plugins.interaction.search = new MyTreeSearch();" should solve that, if you code that MyTreeSearch Please share your results, I'll put your version in wiki as a hack: https://github.com/pixijs/pixi.js/wiki/v5-Hacks Edited November 27, 2019 by ivan.popelyshev Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.