Skip to main content

sync_slider_thumb

Function sync_slider_thumb 

Source
pub fn sync_slider_thumb(
    commands: Commands<'_, '_>,
    parents: Query<'_, '_, (&SliderValue, &Transform, Option<&KnobGeometry>)>,
    thumbs: Query<'_, '_, (Entity, &ChildOf, &mut Style), With<SliderThumb>>,
)
Expand description

Place the SliderThumb child along its track at (value - min) / (max - min), vertically centred. Runs every tick (the position depends on the track’s laid-out size, not just SliderValue); writes only when the target inset actually moved so change detection and relayout stay quiet on idle frames.