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

Method styleSizeUpdate

core/layout.go:1571–1587  ·  view source on GitHub ↗

styleSizeUpdate updates styling size values for widget and its parent, which should be called after these are updated. Returns true if any changed.

()

Source from the content-addressed store, hash-verified

1569// styleSizeUpdate updates styling size values for widget and its parent,
1570// which should be called after these are updated. Returns true if any changed.
1571func (wb *WidgetBase) styleSizeUpdate() bool {
1572 pwb := wb.parentWidget()
1573 if pwb == nil {
1574 return false
1575 }
1576 if !wb.updateParentRelSizes() {
1577 return false
1578 }
1579 scsz := wb.Scene.sceneGeom.Size
1580 sz := wb.Geom.Size.Alloc.Content
1581 psz := pwb.Geom.Size.Alloc.Content
1582 chg := wb.Styles.UnitContext.SetSizes(float32(scsz.X), float32(scsz.Y), sz.X, sz.Y, psz.X, psz.Y)
1583 if chg {
1584 wb.Styles.ToDots()
1585 }
1586 return chg
1587}
1588
1589// Position uses the final sizes to set relative positions within layouts
1590// according to alignment settings.

Callers 2

SizeFinalMethod · 0.95
SizeFinalMethod · 0.80

Calls 4

parentWidgetMethod · 0.95
updateParentRelSizesMethod · 0.95
SetSizesMethod · 0.45
ToDotsMethod · 0.45

Tested by

no test coverage detected