Skip to main content

update_cursor_request

Function update_cursor_request 

Source
pub fn update_cursor_request(
    req: ResMut<'_, CursorRequest>,
    hovered: Query<'_, '_, Entity, With<Hovered>>,
    scrollbar_ix: Option<Res<'_, ScrollbarInteraction>>,
    drags: Query<'_, '_, (Entity, &DragState)>,
    sliders: Query<'_, '_, (), With<SliderValue>>,
    thumbs: Query<'_, '_, (), With<SliderThumb>>,
    inputs: Query<'_, '_, (), With<TextInput>>,
    interactions: Query<'_, '_, (), With<Interaction>>,
    toggles: Query<'_, '_, (), With<Toggleable>>,
    tab_indices: Query<'_, '_, &TabIndex>,
    parents: Query<'_, '_, &ChildOf>,
)
Expand description

Pick the cursor shape for this tick and write it into CursorRequest (change-gated):

  1. Grabbing while a handle drag is in flight - a scrollbar thumb drag (ScrollbarInteraction::drag) or an active DragState on a slider or its thumb child.
  2. Grab with the pointer resting on a scrollbar thumb (ScrollbarInteraction::hover, thumb part) or a slider thumb.
  3. Text (I-beam) over TextInput entities.
  4. Pointer over clickable widgets: the hovered entity or an ancestor carries Interaction (hover/press feedback - the button class), Toggleable, SliderValue, or a non-negative TabIndex.
  5. Default otherwise. Disabled widgets are never Hovered (hit_test skips them), so they fall here automatically.