Not possible to move with interactive objects ( while function contains stopPropagation() )
See original GitHub issueExpected Behavior
Event pointermove
correctly fired on all interactive objects even when function contains event.stopPropagation()
.
Current Behavior
I added two interactive sprites included their interactive functions pointerdown, pointermove, pointerup and pointerupoutside. In each of interactive function I fire event.stopPropagation()
.
In this use case is pointermove
fired only at last sprite.
Check example: https://www.pixiplayground.com/#/edit/m0MxjDUGhTiZ5KU5aRO2C ( you should try move with both sprites, one is not working for me )
Environment
pixi.js
version: 5.1.2 ( older versions as well i think )- Browser & Version: Chrome
- OS & Version: Mac OS
- Running Example: https://www.pixiplayground.com/#/edit/m0MxjDUGhTiZ5KU5aRO2C
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (12 by maintainers)
Top Results From Across the Web
Not possible to move with interactive objects ( while function ...
Expected Behavior Event pointermove correctly fired on all interactive objects even when function contains event.stopPropagation().
Read more >stopPropagation vs. stopImmediatePropagation - Stack Overflow
e.stopImmediatePropagation() stops any further handler from being called for this event, no exceptions · e.stopPropagation() is similar, but does still call all ...
Read more >Event.stopPropagation() - Web APIs | MDN
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Read more >event.stopPropagation() in a modular system - Moxio
If you event.stopPropagation() in the click listener of the checkbox in the bubbling phase the event will no longer bubble up and it...
Read more >A simplified explanation of event propagation in JavaScript.
That e.stopPropagation() halts this “bubbling” of events “up” through the DOM. We stop all of the other events in the stack. Awesome!
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is more fun with event re-use.
The reason it’s “weird” here is pretty much because this line is “missing”:
Because of that both bunnies get the
mousemove
event, but the first bunny event listener stops the propagation of it, so it can’t really reach the second bunny.Now don’t go adding that line just yet, because with it it’s easy to “lose” a bunny while dragging (feel free to try this to find out what I’m talking about.)
Instead only use
.stopPropagation
when you actually “consumed” the event:To really “fix” all this weirdness,
InteractionManager
would need to stop re-using events like that and also set:by default. Because not only is that a performance killer, (we’re dispatching move events to everything), it’s also confusing as hell. On top of that maybe provide a guide on how to do dragging properly: which is to listen to move events on a parent container, not the thing itself.
@laino I rewrited @themoonrat 's fiddle too. Sometimes i forgets clone it. It’s time to fix the playground.I created issues about auto clone: https://github.com/englercj/playground/issues/10