Skip to main content

Module switch

Module switch 

Source

Structs§

Switch
#[serde(from = "SwitchRaw")]: paint() draws the label at self.width + 8, entirely outside the track — and, like slider and countdown, this painter draws from its own fields (self.width/ self.height), never layout.width/layout.height, so the box box_builder.rs assigns (css.width = Px(c.width), no label awareness — see #127) needs to be widened to fit the label, not the paint code changed to fit a box it doesn’t consult. Going through a raw shadow struct lets that extra width be computed once (with the same font metrics paint() uses) and folded into style.width before box_builder.rs ever sees this component, without touching that file.