Skip to main content

cancel_slider_drag_on_escape

Function cancel_slider_drag_on_escape 

Source
pub fn cancel_slider_drag_on_escape(
    commands: Commands<'_, '_>,
    keys: MessageReader<'_, '_, KeyPressed>,
    holders: Query<'_, '_, Entity, With<DragState>>,
    sliders: Query<'_, '_, &mut SliderValue>,
    origins: Query<'_, '_, &SliderDragOrigin>,
    parents: Query<'_, '_, &ChildOf>,
    out: MessageWriter<'_, SliderChanged>,
)
Expand description

Escape while a slider drag is in flight cancels it (Qt drag-cancel contract): the value snaps back to its SliderDragOrigin and the drag machinery is torn down - crate::drag::DragState and Pressed are removed, so the drag doesn’t resume while the button stays held and the eventual pointer release emits no ClickEvent (no release commit). Fires SliderChanged with the restored value so bound signals / scripts roll back too.