MCPcopy Create free account
hub / github.com/cogentcore/core / resetStyleSettings

Method resetStyleSettings

core/style.go:115–122  ·  view source on GitHub ↗

resetStyleSettings reverses the effects of [ApplyStyleSettings] for the widget's font size so that it does not create cascading inhereted font size values. It only does this for non-root elements, as the root element must receive the larger font size so that all other widgets inherit it. It must be

()

Source from the content-addressed store, hash-verified

113// all other widgets inherit it. It must be called before
114// [WidgetBase.runStylers] and [WidgetBase.styleSettings].
115func (wb *WidgetBase) resetStyleSettings() {
116 if tree.IsRoot(wb) {
117 return
118 }
119 fsz := AppearanceSettings.FontSize / 100
120 wb.Styles.Font.Size.Value /= fsz
121 wb.Styles.Text.LineHeight.Value /= fsz
122}
123
124// styleSettings applies [AppearanceSettingsData.Spacing]
125// and [AppearanceSettings.FontSize] to the style values for the widget.

Callers 1

StyleMethod · 0.95

Calls 1

IsRootFunction · 0.92

Tested by

no test coverage detected