Add ui navigation system (RFC 41)#5378
Closed
nicopap wants to merge 30 commits intobevyengine:mainfrom
Closed
Conversation
19 tasks
Contributor
Author
Contributor
|
Edit: left comment on wrong PR |
nicopap
added a commit
to nicopap/ui-navigation
that referenced
this pull request
Jul 31, 2022
This backports changes in bevyengine/bevy#5378 into bevy-ui-navigation. Closes #29 (update to bevy 0.8) which: - Fixes #28 (default selection is wrong) - Fixes #27 (poor docs on `Locked`) - Fixes #25 (typo in doc)
00972fa to
0c877bc
Compare
As it was added in bevyengine#5252
* now bevy_ui compiles * dormant → prioritized * NavMenu → MenuSetting * MoveParam → MenuNavigationStrategy * Remove `focus` module of bevy_ui (superseded by bevy_ui_navigation) * Replace the seed system by a simple MenuBuilder component * Add Reflect derives to bevy_ui_navigation types * implement the bevy_ui input for navigation (may include handling of clipping) * Minor refactors (cmds → commands etc.) * Remove moveable UI camera handling (since it is currently impossible)
- Add back FocusPolicy - Add a Hover component - Use the old focus system instead of the new mouse input system
- Use `Hover` for mouse hover in various examples - Use `nav_iter` to simplify dealing with EventReader<NavEvent>
also: - rename seeds => menu - update examples README - stub new examples
- Move focusable type definitions to its own module, unbloats the
resolve.rs file
- Move some free functions in resolve.rs to methods of NavQueries,
it makes more sense this way
- Move the focus update logic to a method of MutQueries,
this allows re-using it in both list_nav_requests and
set_initial_focusable
- Fixes issue where path was not properly activated if the initial
focused element with already deeply nested in a menu.
- Add test and helper methods for this to work
- Add a mut commands field to MutQueries, this allows simplifying the
parameters on the new methods of MutQueries
- Add tests and helpers to check how good we survive the death of
focused elements
- Removed stubs for tests we don't expect to pass in the first draft of
this PR
- move insert_tree_menus to menu.rs
- Remove serde derives now that enum reflection is merged
The user now can mark a Focusable as blocked, preventing navigation to it (with a few noted exception). This might be useful if the user intend to dynamically hide/show parts of the UI and want to prevent navigation hidden focusable entities.
Focus following mouse cursor is contrary to the way most UI frameworks handle focus. This as the default behavior is surprising. Furthermore, the default systems do not provide a more traditional mouse focus handler. This commit adds a way to have a more traditional mouse focus system and makes it the default. Now, focus changes to the hovered element only when the mouse button is pressed, or when it is released if the currently hovered element wasn't focused yet. We also add a `focus_follows_cursor` field to the `InputMapping` to allow users to switch to the older behavior. This also makes it much easier to handle situations when we click on a button that changes focus. A major downside is that the user must now implement themselves hover highlight.
1e4d242 to
7d2fbe8
Compare
Contributor
|
Backlog cleanup: closing due to inactivity, and in the context of extensive work (and planned work) already underway in the UI space. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
TODO
This is a WIP.
cursor_navigation)bevy_uito compileseedsbundles by a single component.Hoverablecomponent(TODO for myself):
NavRequestSystemis misleadingDifferences with bevy-ui-navigation
markingmodule and marking menus are gonebevy_ui-related systems are now defined inbevy_uievent_helpersmodule is gone, replaced by theNavEventReaderExt::nav_itertrait extension method onEventReader<NavEvent>and theNavEventReadermethods.dormant→prioritized, NavMenu → MenuSetting)seedsmodule to make it much simplerChangelog
bevy_uiMigration Guide
InteractionwithFocusable, and instead of matching on the component itself, match on the return value of thefocusable.state()method.Hovercomponent, instead ofInteraction.Interaction::Clickedhas noFocusableequivalent, you should useEventReader<NavEvent>instead now.