mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 17:05:38 +00:00
ui: move macro recording from Ops to MacroOp
Move the Record and Stop methods from Ops to MacroOp itself. Before this change, Ops.Stop stopped the recording of the most recent macro, which could be a different macro than intended. After this change, there is no such confusion. As a bonus, the Ops API becomes less cluttered. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-3
@@ -11,6 +11,7 @@ import (
|
||||
type Stack struct {
|
||||
Alignment Direction
|
||||
|
||||
macro ui.MacroOp
|
||||
ops *ui.Ops
|
||||
constrained bool
|
||||
cs Constraints
|
||||
@@ -54,7 +55,7 @@ func (s *Stack) begin() {
|
||||
panic("must End before adding a child")
|
||||
}
|
||||
s.begun = true
|
||||
s.ops.Record()
|
||||
s.macro.Record(s.ops)
|
||||
}
|
||||
|
||||
func (s *Stack) Rigid() Constraints {
|
||||
@@ -71,7 +72,7 @@ func (s *Stack) Expand() Constraints {
|
||||
}
|
||||
|
||||
func (s *Stack) End(dims Dimens) StackChild {
|
||||
b := s.ops.Stop()
|
||||
s.macro.Stop()
|
||||
s.begun = false
|
||||
if w := dims.Size.X; w > s.maxSZ.X {
|
||||
s.maxSZ.X = w
|
||||
@@ -84,7 +85,7 @@ func (s *Stack) End(dims Dimens) StackChild {
|
||||
s.baseline = b
|
||||
}
|
||||
}
|
||||
return StackChild{b, dims}
|
||||
return StackChild{s.macro, dims}
|
||||
}
|
||||
|
||||
func (s *Stack) Layout(children ...StackChild) Dimens {
|
||||
|
||||
Reference in New Issue
Block a user