From ead3cd487aa13f6ecc2036bdec455de68655e4e5 Mon Sep 17 00:00:00 2001 From: aiongg Date: Fri, 27 Nov 2026 17:15:24 +0000 Subject: [PATCH] Layers panel requests are cleared only once the panel reports them taken Rename, reveal and Find Layers focus are one-time requests the app passes to LayersPanel. The app cleared them after every call, also after a measuring run that applies none. It now clears them on LayersOutput::requests_taken (craft-layers), which the panel sets from its real run. --- crates/ui-egui/src/panels/layer_reveal.rs | 8 ++++---- crates/ui-egui/src/panels/layers.rs | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/ui-egui/src/panels/layer_reveal.rs b/crates/ui-egui/src/panels/layer_reveal.rs index fddbd6cc8a..284f495a3e 100644 --- a/crates/ui-egui/src/panels/layer_reveal.rs +++ b/crates/ui-egui/src/panels/layer_reveal.rs @@ -6,7 +6,7 @@ //! //! The command dispatch takes a [`mark`] before a command and calls [`file`] after it; when the //! active layer moved, the reveal waits in `PhotocraftApp::pending_reveal` until the panel next -//! draws and [`take`]s it, so a hidden panel reveals the layer when it is shown again. +//! draws and applies it, so a hidden panel reveals the layer when it is shown again. //! //! Only a change of the active layer reveals: closing the group that holds it, or scrolling //! away, is left alone until the next change. @@ -50,9 +50,9 @@ pub(crate) fn file(app: &mut PhotocraftApp, before: Mark) { app.pending_reveal = Some((id, groups)); } -/// The pending reveal, for the Layers panel's draw: the layer and what its closed parent groups -/// do. The first pass of a frame takes it, so a second pass in the same frame reveals nothing -/// again. +/// The pending reveal: the layer and what its closed parent groups do. The Layers panel takes it +/// once its real run applied it (`LayersOutput::requests_taken`), so a measuring run or a later +/// pass of the same frame reveals nothing again. pub(crate) fn take(app: &mut PhotocraftApp) -> Option<(LayerId, Groups)> { app.pending_reveal.take() } diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index 9ec0163369..59a627b4c0 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -23,7 +23,7 @@ pub(super) fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) { use super::layers_tree::{self, PhotoThumbs}; // A Move-way pick of a layer opens its groups only when the Move option says so (#11381). - let reveal = crate::layer_reveal::take(app); + let reveal = app.pending_reveal; let ctx = ui.ctx().clone(); // Thumbnail Contents is the clip preference alone, so the panel reads it each pass. app.ui.layers_settings.options.thumbnail_contents = crate::layers_panel_ui::thumbnail_contents(app); @@ -62,8 +62,11 @@ pub(super) fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) { panel = panel.start_rename(id); } let out = panel.show(ui); - app.find_layers_focus = false; - app.layers_rename = None; + if out.requests_taken { + crate::layer_reveal::take(app); + app.find_layers_focus = false; + app.layers_rename = None; + } if filter != before { app.ui.layer_filter = filter; }