Commit 463a73d
authored
# Objective
- Fixes #22305
- Avoid feature flagging
## Solution
Taking inspiration from #22309 and building off of #22333, this moves
the auto directional navigation to `bevy_ui` and creates a new system
parameter to be used when including automatic navigation.
- directional_navigation.rs of `bevy_input_focus` still contains the
`DirectionalNavigation` system parameter, but it now only contains logic
to do manual navigation. The `DirectionalNavigationPlugin` is still
there, as well as the manual edge map.
- I separated out some code from directional_navigation.rs into two
separate files:
1) directional_navigation.rs in `bevy_ui` which contains the automatic
navigation code. There is a new system parameter now,
`AutoDirectionalNavigator`, that wraps the `DirectionalNavigation`
system parameter and does automatic navigation if manual navigation
fails.
2) navigator.rs which contains some structs and functions that are used
by both the automatic navigation system and the manual navigation code
in directional_navigation.rs. This particular refactoring wasn’t
particularly necessary, but I feel like the code is little more cleaner
for it… I can revert this change if desired
If you think a feature is better for this, then let me know whether
#22333 should be considered instead.
If this gets merged, I’ll open up a pull request against `release-0.18`
to update the release notes, basically saying that users who want to
leverage `AutoDirectionalNavigation` need to use the
`AutoDirectionalNavigator` instead of the existing
`DirectionalNavigation` system param.
## Testing
To ensure no regressions, I tested the directional navigation examples
and both work as they did before.
`cargo run --example directional_navigation` - uses the existing
`DirectionalNavigation` system parameter
`cargo run --example auto_directional_navigation` - uses the new
`AutoDirectionalNavigator` system parameter
1 parent 53ae507 commit 463a73d
File tree
8 files changed
+555
-506
lines changed- crates
- bevy_input_focus
- src
- bevy_ui
- src
- examples/ui
8 files changed
+555
-506
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | | - | |
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
| |||
0 commit comments