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

Method Position

core/tree.go:571–594  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

569}
570
571func (tr *Tree) Position() {
572 rn := tr.root
573 if rn == nil {
574 slog.Error("core.Tree: RootView is nil", "in node:", tr)
575 return
576 }
577 tr.setBranchState()
578 sz := &tr.Geom.Size
579 sz.Actual.Total.X = rn.Geom.Size.Actual.Total.X - (tr.Geom.Pos.Total.X - rn.Geom.Pos.Total.X)
580 sz.Actual.Content.X = sz.Actual.Total.X - sz.Space.X
581 tr.widgetSize.X = sz.Actual.Total.X
582 tr.WidgetBase.Position() // just does our parts
583
584 if !tr.Closed {
585 h := tr.widgetSize.Y
586 tr.ForWidgetChildren(func(i int, cw Widget, cwb *WidgetBase) bool {
587 cwb.Geom.RelPos.Y = h
588 cwb.Geom.RelPos.X = tr.Indent.Dots
589 h += cwb.Geom.Size.Actual.Total.Y
590 cw.Position()
591 return tree.Continue
592 })
593 }
594}
595
596func (tr *Tree) ApplyScenePos() {
597 sz := &tr.Geom.Size

Callers

nothing calls this directly

Calls 4

setBranchStateMethod · 0.95
ForWidgetChildrenMethod · 0.80
ErrorMethod · 0.65
PositionMethod · 0.65

Tested by

no test coverage detected