-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New navigation example combining auto and manual directional nav
#22405
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
base: main
Are you sure you want to change the base?
Conversation
it-me-joda
left a comment
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 that I personally would rather have each navigation mode in a separate example. Then maybe a third that demonstrates that you could combine them? This current state is overwhelming at first glance. I think I would have examples like:
ui/navigation/
auto-navigation
manual-navigation
combined-navigation
But that's just my personal opinion. I'd be curious to see what others think about it.
|
I agree with @it-me-joda here, with the emphasis in the third example focusing on how and why to use overrides. |
| highlight_focused_element, | ||
| interact_with_focused_button, | ||
| reset_button_after_interaction, | ||
| update_focus_display, |
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.
Text updates are expensive, so better to only update the labels on changes:
| update_focus_display, | |
| update_focus_display.run_if(|input_focus: Res<InputFocus>| input_focus.is_changed()),, |
It's not that much text, but atm there is a bug where a new font is created every text update (#22419). After leaving the example running for a while, you'll see a significant delay in moving the cursor.
Objective
bevy_input_focus: No example demonstrates how to use theDirectionalNavigationMapand automatic navigation together #22299Solution
navigation(examples/ui/navigation.rs) that demonstrates both auto navigation and manually defining/overriding edges via theDirectionalNavigationMap. The example basically copies code from the purely auto navigation example (examples/ui/auto_directional_navigation.rs) as a base, changes the grid of buttons in the middle, and adds the manual map configuration.Testing
cargo run --example navigation.Showcase
Screen Recording
Screen.Recording.2026-01-06.at.4.29.42.PM.mov