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) } }