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

Method layoutScene

core/render.go:95–130  ·  view source on GitHub ↗

layoutScene does a layout of the scene: Size, Position

()

Source from the content-addressed store, hash-verified

93
94// layoutScene does a layout of the scene: Size, Position
95func (sc *Scene) layoutScene() {
96 if DebugSettings.LayoutTrace {
97 fmt.Println("\n############################\nLayoutScene SizeUp start:", sc)
98 }
99 sc.SizeUp()
100 sz := &sc.Geom.Size
101 sz.Alloc.Total.SetPoint(sc.sceneGeom.Size)
102 sz.setContentFromTotal(&sz.Alloc)
103 // sz.Actual = sz.Alloc // todo: is this needed??
104 if DebugSettings.LayoutTrace {
105 fmt.Println("\n############################\nSizeDown start:", sc)
106 }
107 maxIter := 3
108 for iter := 0; iter < maxIter; iter++ { // 3 > 2; 4 same as 3
109 redo := sc.SizeDown(iter)
110 if redo && iter < maxIter-1 {
111 if DebugSettings.LayoutTrace {
112 fmt.Println("\n############################\nSizeDown redo:", sc, "iter:", iter+1)
113 }
114 } else {
115 break
116 }
117 }
118 if DebugSettings.LayoutTrace {
119 fmt.Println("\n############################\nSizeFinal start:", sc)
120 }
121 sc.SizeFinal()
122 if DebugSettings.LayoutTrace {
123 fmt.Println("\n############################\nPosition start:", sc)
124 }
125 sc.Position()
126 if DebugSettings.LayoutTrace {
127 fmt.Println("\n############################\nScenePos start:", sc)
128 }
129 sc.ApplyScenePos()
130}
131
132// layoutRenderScene does a layout and render of the tree:
133// GetSize, DoLayout, Render. Needed after Config.

Callers 2

layoutRenderSceneMethod · 0.95
prefSizeMethod · 0.95

Calls 8

ApplyScenePosMethod · 0.95
PrintlnMethod · 0.80
SetPointMethod · 0.80
setContentFromTotalMethod · 0.80
SizeUpMethod · 0.65
SizeDownMethod · 0.65
SizeFinalMethod · 0.65
PositionMethod · 0.65

Tested by

no test coverage detected