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

Method prefSize

core/render.go:263–276  ·  view source on GitHub ↗

prefSize computes the preferred size of the scene based on current contents. initSz is the initial size -- e.g., size of screen. Used for auto-sizing windows.

(initSz image.Point)

Source from the content-addressed store, hash-verified

261// initSz is the initial size -- e.g., size of screen.
262// Used for auto-sizing windows.
263func (sc *Scene) prefSize(initSz image.Point) image.Point {
264 sc.updating = true // prevent rendering
265 defer func() { sc.updating = false }()
266
267 sc.prefSizing = true
268 sc.updateScene()
269 sc.applyStyleScene()
270 sc.layoutScene()
271 sz := &sc.Geom.Size
272 psz := sz.Actual.Total
273 sc.prefSizing = false
274 sc.showIter = 0
275 return psz.ToPointFloor()
276}
277
278//////////////////////////////////////////////////////////////////
279// Widget local rendering

Callers 3

runWindowMethod · 0.80
runDialogMethod · 0.80
runPopupMethod · 0.80

Calls 4

updateSceneMethod · 0.95
applyStyleSceneMethod · 0.95
layoutSceneMethod · 0.95
ToPointFloorMethod · 0.80

Tested by

no test coverage detected