question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stage keeps propagating handled touch events

See original GitHub issue

I just stumbled over this issue: http://gamedev.stackexchange.com/questions/106120/stopping-actor-tap-click-event-from-propagating

I believe this might be a bug in Stage. Looking at its touchUp handler (or any of the other handlers), it doesn’t appear to stop events from propagating when listeners handle it, since it makes no attempt to break out of the loop if Event#isHandled() is true: https://github.com/libgdx/libgdx/blob/2bd1557bc293cb8c2348374771aad832befbe26f/gdx/src/com/badlogic/gdx/scenes/scene2d/Stage.java#L348

This means that it’s impossible to receive click events in actors and swallow them in order to prevent them from triggering other game behavior in response to taps on the stage.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Darkyenuscommented, Aug 29, 2015

Ah, I assumed InputListener. The returning is done in handle(Event) method of EventListener. InputListener returns whatever its (usually overriden) touchDown/Up/whatever returned. For ActorGestureListener this is slightly more complicated, because it does not support “not detecting gesture” and always returns true. Therefore, you will have to override the handle() method and add custom gesture-filtering logic.

0reactions
NathanSweetcommented, Nov 25, 2016

Explanations by @Darkyenus are correct.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Controlling touch event propagation in case of overlapping ...
My current problem is that each card has a button and since relative card displacement is smaller than height of the button it...
Read more >
Event Bubbling and Event Catching in JavaScript and React
Capturing Phase – The is first phase when an event is actually triggered. This event “captures” or propagates first through the topmost event ......
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 >
Bubbling and capturing - The Modern JavaScript Tutorial
The capturing phase is used very rarely, usually we handle events on bubbling. And there's a logical explanation for that.
Read more >
The Dangers of Stopping Event Propagation - CSS-Tricks
This would allow event listeners registered farther up the DOM to inspect an event and, based on whether or not it had been...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found