From 6769a5ca210d292bb81a7633f6b2e165b7737b6d Mon Sep 17 00:00:00 2001 From: aiongg Date: Fri, 20 Nov 2026 15:10:15 +0000 Subject: [PATCH] craft-ui-panels: the tool rail derives its remembered tools under the slots', last-used and hidden revisions --- crates/ui-panels/src/rails/tool.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/ui-panels/src/rails/tool.rs b/crates/ui-panels/src/rails/tool.rs index 0e76f6049..0fc0f1c46 100644 --- a/crates/ui-panels/src/rails/tool.rs +++ b/crates/ui-panels/src/rails/tool.rs @@ -314,7 +314,11 @@ impl<'a, T: Value + MemoProps + PlainData + 'static> ToolRail<'a, T> { /// Shows the rail laid out `width` wide. fn show_within(mut self, ui: &mut Ui, width: f32, footer: impl FnMut(&mut Ui, RailFooter) + 'a) -> ToolRailOutput { let draw = self.prepare(ui, width, footer); - let last = remembered(draw.slots, draw.current, draw.last_used); + // The last-used tools after this pass: derived while the slots, the remembered and hidden tools and the current tool are as they were. + let key = (draw.slots.revision(), draw.last_used.revision(), draw.hidden.map(Tracked::revision), draw.current); + let last = + crate::runtime::derived::derived(ui.ctx(), ui.id().with("remembered"), &key, || remembered(draw.slots, draw.current, draw.last_used)); + let last = last.as_ref().clone(); let (mut events, mut edit_toolbar) = (Vec::new(), None); let shown = self.show(ui, |ui, _| edit_toolbar = draw.run(ui, &mut events)); let (mut select, mut double_clicked, mut flyout, mut dropped) = (None, None, None, None);