Consuming events/halting event propagation #11
JoshSauter
started this conversation in
Feature Requests
Replies: 1 comment
-
Version 1.0.3 has been released with this change! All events now have a Consume extension, and you can see an example of the usage here. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Nova's input system propagates events upwards through a UIBlock's hierarchy, which is certainly a good way of structuring the event system for when you need it, but often I only want the top-level element actively receiving the event to process it. I'm able to get the behavior I want by attaching a condition to all of my event handlers that returns immediately if the event's Receiver is not this UIBlock, but it would be nice to have some way of "consuming" events such that they do not continue propagation upwards through the hierarchy.
For instance, if I have A as a parent of B as a parent of C, and an event is fired where the Receiver is C, it would be nice if my event handler for C could call some
evt.Consume()
method or some equivalent to prevent A and B event handlers from ever receiving the event. Right now if I want that functionality, I have to have conditions guarding both my A and B event handlers to ensure the top-level element clicked on is this.Beta Was this translation helpful? Give feedback.
All reactions