forked from joejulian/gio
ui/layout: clean up after function scope change
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+2
-6
@@ -98,7 +98,8 @@ func (l *List) init(cfg ui.Config, q input.Queue, ops *ui.Ops, cs Constraints, l
|
||||
// Layout the List and return its dimensions.
|
||||
func (l *List) Layout(c ui.Config, q input.Queue, ops *ui.Ops, cs Constraints, len int, w ListElement) Dimensions {
|
||||
for l.init(c, q, ops, cs, len); l.more(); l.next() {
|
||||
l.end(w(l.constraints(), l.index()))
|
||||
cs := axisConstraints(l.Axis, Constraint{Max: inf}, axisCrossConstraint(l.Axis, l.cs))
|
||||
l.end(w(cs, l.index()))
|
||||
}
|
||||
return l.layout()
|
||||
}
|
||||
@@ -145,11 +146,6 @@ func (l *List) index() int {
|
||||
}
|
||||
}
|
||||
|
||||
// constraints is the constraints for the current child.
|
||||
func (l *List) constraints() Constraints {
|
||||
return axisConstraints(l.Axis, Constraint{Max: inf}, axisCrossConstraint(l.Axis, l.cs))
|
||||
}
|
||||
|
||||
// more reports whether more children are needed.
|
||||
func (l *List) more() bool {
|
||||
return l.dir != iterateNone
|
||||
|
||||
@@ -19,7 +19,6 @@ type Stack struct {
|
||||
ops *ui.Ops
|
||||
constrained bool
|
||||
cs Constraints
|
||||
begun bool
|
||||
maxSZ image.Point
|
||||
baseline int
|
||||
}
|
||||
@@ -44,10 +43,6 @@ func (s *Stack) begin() {
|
||||
if !s.constrained {
|
||||
panic("must Init before adding a child")
|
||||
}
|
||||
if s.begun {
|
||||
panic("must End before adding a child")
|
||||
}
|
||||
s.begun = true
|
||||
s.macro.Record(s.ops)
|
||||
}
|
||||
|
||||
@@ -72,7 +67,6 @@ func (s *Stack) Expand(w Widget) StackChild {
|
||||
// End a child by specifying its dimensions.
|
||||
func (s *Stack) end(dims Dimensions) StackChild {
|
||||
s.macro.Stop()
|
||||
s.begun = false
|
||||
if w := dims.Size.X; w > s.maxSZ.X {
|
||||
s.maxSZ.X = w
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user