From 352984d6d9b14bee9047e7d1f0e7a2f0dc330ede Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sun, 24 May 2020 18:42:22 +0200 Subject: [PATCH] Overlays must be handled & rendered in their order. --- ui/overlays.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/overlays.go b/ui/overlays.go index 40ae4cc..6f3dc6c 100644 --- a/ui/overlays.go +++ b/ui/overlays.go @@ -75,8 +75,8 @@ func (o *Overlays) Arrange(ctx Context, bounds geom.RectangleF32, offset geom.Po func (o *Overlays) Handle(ctx Context, e Event) bool { var handled bool - for overlay, visible := range o.visible { - if visible { + for _, overlay := range o.order { + if o.visible[overlay] { if o.overlays[overlay].Handle(ctx, e) { // handle all overlays regardless of return value handled = true } @@ -92,8 +92,8 @@ func (o *Overlays) Hide(name string) { o.SetVisibility(name, false) } func (o *Overlays) Render(ctx Context) { o.Proxy.Render(ctx) - for overlay, visible := range o.visible { - if visible { + for _, overlay := range o.order { + if o.visible[overlay] { o.overlays[overlay].Render(ctx) } }