-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add event for clicks #9240
Add event for clicks #9240
Conversation
Made some changes @Shatur, let me know what you think. Found some other examples that I'm happy to change to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we have more examples, could you update them too?
examples/ui/size_constraints.rs
examples/ui/display_and_visibility.rs
examples/ui/button.rs
examples/mobile/src/lib.rs
crates/bevy_ui/src/focus.rs
Apologies still working on this and will hopefully have it done in a week probably. Real life nonsense currently imposing. :( |
Take your time, hope everything is alright! |
@AnthonyKalaitzis hope that you are doing okay! Let me know if you are not longer interested, I will finish this PR for you. |
@Shatur Mega apologies, fell of the face of the earth there for a bit (employment interviews zzzzz). Will have the other examples finished by today or tomorrow hopefully. Just pushed one to let people know I'm still alive and working on it. Sorry again for the delay 😢 |
Just a small question: Why not send the click event in |
This sounds like a great suggestion! @AnthonyKalaitzis could you try the suggested approach? I think you can do it here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you a lot!
One minor nitpick that you can apply from browser and we are good to go
Big thanks @Shatur for sticking with me through that painful process 😄! Very much a learning experience for me, haven't done much open source stuff before. Big thanks 🥇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think at some point we'll want better handling of cases where there are multiple elements on top of each other (so the top element captures the event, and it doesn't fire on all overlapping elements). But this seems like an improvement over what we have.
@AnthonyKalaitzis could you resolve conflicts? |
Adopted in #10141. Don't worry, credit will be shared if this gets merged and your ongoing participation in that thread would be welcome. |
Objective
Solution
Click
events when anInteraction
goes fromInteraction::Hovered
toInteraction::Pressed
Click
event sends intoUiPlugin
by defaultgame_menu.rs
example to useClick
rather then manually checking theInteraction
As an aside, I haven't changed any other bevy example that could use
Click
just yet. If my implementation is along the lines of what people want then happy to skim through the UI examples and migrate them to useClick
if wanted.Possibly interested party @Shatur :)