Trait MenuNavigationStrategy

Source
pub trait MenuNavigationStrategy {
    // Required method
    fn resolve_2d<'a>(
        &self,
        focused: Entity,
        direction: Direction,
        cycles: bool,
        siblings: &'a [Entity],
    ) -> Option<&'a Entity>;
}
Expand description

System parameter used to resolve movement and cycling focus updates.

This is useful if you don’t want to depend on bevy’s GlobalTransform for your UI, or want to implement your own navigation algorithm. For example, if you want your ui to be 3d elements in the world.

Required Methods§

Source

fn resolve_2d<'a>( &self, focused: Entity, direction: Direction, cycles: bool, siblings: &'a [Entity], ) -> Option<&'a Entity>

Which Entity in siblings can be reached from focused in direction if any, otherwise None.

  • focused: The currently focused entity in the menu
  • direction: The direction in which the focus should move
  • cycles: Whether the navigation should loop
  • sibligns: All the other focusable entities in this menu

Note that focused appears once in siblings.

Implementors§