Jump to content

Interaction Event Propagation


alex_h
 Share

Recommended Posts

Say I have two sprites, one the size of the screen, and one 100px circle in front of that. Both are interactive. The full screen one has a listener for pointerup events, and the circle in front has a listener to pointerdown events. Is there a way to make the circle allow pointerup events to continue to propagate so that if the user happens to pointerup over it, the event continues to get processed by the full screen sprite behind it?

I am interested in solutions that work for all pixi versions >= 4

Link to comment
Share on other sites

propagation does work only to parents, not to siblings. You can make it that sprite immune to pointerUp , you have to make your own TreeSearch for that, copy original and add whatever is needed there: https://github.com/pixijs/pixijs/blob/01a69a1465b875cb7b97a10caa9c35d9505397ff/packages/interaction/src/TreeSearch.ts#L36  , it was introduced in v5. You can override things with "renderer.plugins.interaction.search = new MyTreeSearch()". In v4 you have to do the same with processInteractive method inside interactionManager itself

Link to comment
Share on other sites

  • 2 weeks later...

One situation here too:

Let's say we have multiple sprites(circles images) created from an array with object, and when we click on one circle it's moving from left to right(only the one we clicked). When the one is moving I want to make the others interactive=false, but if I'm doing that the one that is moving will stop because it can't find the events(not sure if I explained right but hope someone understand). How I can make the others not interactive but also keep the event on the one that is moving?

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...