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)
| 261 | // initSz is the initial size -- e.g., size of screen. |
| 262 | // Used for auto-sizing windows. |
| 263 | func (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 |
no test coverage detected