From 1c7827e5cffff2ed027b89e36fef98be2a1fd8b4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 27 Nov 2026 07:18:24 -0800 Subject: [PATCH] Keep unchanged Layer and Object Options out of Undo --- crates/ui-egui/src/dialogs/layer_options.rs | 210 +++++++++++++++++++- crates/ui-egui/src/menus/ui_commands.rs | 2 +- docs/mcp.md | 4 +- docs/ui-parity.md | 4 +- 4 files changed, 211 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/src/dialogs/layer_options.rs b/crates/ui-egui/src/dialogs/layer_options.rs index c25df0cf41..fb0ad99911 100644 --- a/crates/ui-egui/src/dialogs/layer_options.rs +++ b/crates/ui-egui/src/dialogs/layer_options.rs @@ -7,6 +7,7 @@ //! `#rrggbb`), `template`, `locked`, `visible`, `printable`, `preview`, `dimImages` and //! `dimPercent`. OK runs `layer.setProps`, `layer.new` or `layer.newSublayer`. For several rows //! the dialog shows the first row's settings, and OK sends only the ones set in the dialog. +//! Existing rows keep their stored names unless Name is edited; unchanged approval adds no Undo step. use std::cell::RefCell; @@ -327,7 +328,9 @@ fn flag_row(ui: &mut egui::Ui, v: &mut LayerOptionsValue, key: &'static str, tex fn body(ui: &mut egui::Ui, v: &mut LayerOptionsValue, requested: &RefCell>) { if v.shows("name") { Field::new(tl!("Name:")).id_salt("name").show(ui, |ui, _| { - TextField::new(tl!("Name:"), Bind::bound(&mut v.name)).show(ui); + if TextField::new(tl!("Name:"), Bind::bound(&mut v.name)).show(ui).value().is_some() { + v.mark("name"); + } }); } if v.layer { @@ -379,7 +382,7 @@ fn body(ui: &mut egui::Ui, v: &mut LayerOptionsValue, requested: &RefCell