From 48d5a9b82a3e83c283e1f98cfad659170ad12650 Mon Sep 17 00:00:00 2001 From: Maarten de Vries Date: Sat, 30 Mar 2024 11:37:15 +0100 Subject: [PATCH] Preserve order of overlays when removing one. --- CHANGELOG.md | 1 + src/backend/window.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b34e8c..c8ac215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Expose `winit` support for `WindowTouchpadMagnifyEvent` and `WindowTouchpadRotateEvent` on supported platforms. * Bump minimum `tch` version to `0.13.0`. * Bump supported `image` version to `0.25`. + * Preserve order of overlays when removing one. # v0.13.1 - 2022-09-16 * Tweak the behavior of `set_overlay` to preserve visibility of existing overlays. diff --git a/src/backend/window.rs b/src/backend/window.rs index a420c7f..74db233 100644 --- a/src/backend/window.rs +++ b/src/backend/window.rs @@ -294,7 +294,7 @@ impl<'a> WindowHandle<'a> { /// /// Returns `true` if there was an overlay to remove. pub fn remove_overlay(&mut self, name: &impl AsRef) -> bool { - let removed = self.window_mut().overlays.remove(name.as_ref()).is_some(); + let removed = self.window_mut().overlays.shift_remove(name.as_ref()).is_some(); self.window().window.request_redraw(); removed }