commit 5c8ab0ce07e3a3b9baa18667ffe94b8591666bc6
parent 590ffa0680aa61676e279941e640db30a757b78c
Author: William Casarin <jb55@jb55.com>
Date: Mon, 28 Jul 2025 12:19:45 -0700
media/viewer: handle click-to-close interactions
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/crates/notedeck_columns/src/app.rs b/crates/notedeck_columns/src/app.rs
@@ -396,7 +396,7 @@ fn fullscreen_media_viewer_ui(
// Close it?
if ui.input(|i| i.key_pressed(egui::Key::Escape)) {
- options.set(AppOptions::FullscreenMedia, false);
+ fullscreen_media_close(options, viewer_state);
return;
}
@@ -405,10 +405,16 @@ fn fullscreen_media_viewer_ui(
.ui(img_cache, ui);
if resp.clicked() {
- options.set(AppOptions::FullscreenMedia, false);
+ fullscreen_media_close(options, viewer_state);
}
}
+/// Close the fullscreen media player. This also resets the scene_rect state
+fn fullscreen_media_close(options: &mut AppOptions, state: &mut MediaViewerState) {
+ options.set(AppOptions::FullscreenMedia, false);
+ state.scene_rect = None;
+}
+
/*
fn determine_key_storage_type() -> KeyStorageType {
#[cfg(target_os = "macos")]