Skip to main content

ferroui_base/input/
find_next_element_options.rs

1use super::navigation::XYFocusNavigationStrategy;
2use super::InputElement;
3use crate::{Rect, Ref};
4
5/// Provides options to customize the behavior when identifying the next
6/// element to focus during a navigation operation.
7#[derive(Clone, Default)]
8pub struct FindNextElementOptions {
9    /// The element that will be treated as the starting point of the search
10    /// for the next focusable element. This does not need to be the element
11    /// that currently has focus. If `None`, the focus manager's current
12    /// focus is used.
13    pub focused_element: Option<Ref<InputElement>>,
14
15    /// The root within which the search for the next focusable element will
16    /// be conducted.
17    ///
18    /// This property defines the boundary for focus navigation operations.
19    /// It determines the root element in the visual tree under which the
20    /// focusable item search is performed. If not specified, the search
21    /// defaults to the current scope.
22    pub search_root: Option<Ref<InputElement>>,
23
24    /// The rectangular region within the visual hierarchy that will be
25    /// excluded from consideration during focus navigation.
26    pub exclusion_rect: Rect,
27
28    /// A rectangular region that acts as a hint for focus navigation: a
29    /// preferred or prioritized target when navigating focus. Can be `None`
30    /// if no specific hint region is provided.
31    pub focus_hint_rectangle: Option<Rect>,
32
33    /// The navigation strategy to apply when navigating focus between
34    /// elements; overrides the default strategy when set.
35    pub navigation_strategy_override: Option<XYFocusNavigationStrategy>,
36
37    /// Whether occlusivity (overlapping of elements) should be ignored
38    /// during focus navigation. When true, the navigation logic disregards
39    /// obstructions that may block a potential focus target.
40    pub ignore_occlusivity: bool,
41}