Skip to main content

sync_checkbox_visuals

Function sync_checkbox_visuals 

Source
pub fn sync_checkbox_visuals(
    commands: Commands<'_, '_>,
    parents_q: Query<'_, '_, (&Toggleable, Option<&Indeterminate>, &CheckboxStyle)>,
    boxes: Query<'_, '_, (Entity, &ChildOf, &mut Visuals, &mut StyleOverrides, Option<&mut TextContent>), With<CheckboxBox>>,
)
Expand description

Keep every .checkbox-box child in step with its parent state:

  • fill: checked_bg while checked OR indeterminate, the box’s own fill otherwise;
  • mark glyph: MARK_CHECKED checked, MARK_INDETERMINATE indeterminate, empty otherwise.

Runs every tick (marker components move without a single Changed filter to hang off); writes only on actual diffs so change detection stays quiet on idle frames.