Skip to main content

sync_track_fill

Function sync_track_fill 

Source
pub fn sync_track_fill(
    tracks: Query<'_, '_, (&Toggleable, &TrackStyle, Has<Disabled>, &mut Visuals, &mut StyleOverrides)>,
)
Expand description

Paint every <toggle> / <switch> track with the fill its current state calls for. This is the single owner of a track’s Visuals::fill; the per-widget sync systems only move the knob.

The state fill is held in StyleOverrides under the hover and press tints, so a tint blends from it and lets go onto it, and a restyle keeps it: state, not the cascade, decides what a track shows. It runs every tick rather than on Changed<Toggleable>, because the state is not the only thing that moves the fill: a restyle recomputes the TrackStyle palette on a theme or media flip. Writes happen only when the fill differs, so an idle frame still triggers no change detection.