ui: make OpPush and OpPop explicit

We're about to allow OpBlock for invoking ops from multiple (cached)
Ops containers. To allow for drawing state changes to stick after
invoking such a cached block, we can't let OpBlock perform an implicit
save and restore of drawing state.

Instead, introduce OpPush and OpPop for explicit drawing state stack
management.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-06-02 15:10:09 +02:00
parent bf5d083b8a
commit 9142345fd4
7 changed files with 28 additions and 20 deletions
+2 -2
View File
@@ -101,10 +101,10 @@ func (s *Stack) Layout(ops *ui.Ops, children ...StackChild) Dimens {
case SW, S, SE:
p.Y = s.maxSZ.Y - sz.Y
}
ops.Begin()
ui.OpPush{}.Add(ops)
ui.OpTransform{Transform: ui.Offset(toPointF(p))}.Add(ops)
ch.block.Add(ops)
ops.End().Add(ops)
ui.OpPop{}.Add(ops)
}
b := s.baseline
if b == 0 {