From f0b6f5208aece024d9d0d762828fdbff841923bb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 27 Nov 2026 22:35:31 -0800 Subject: [PATCH] Tangent Circle Tool: a second click opens the radius dialog as a new held dialog The dialog host now ties each held record to one opening of a dialog, and drops a record whose dialog was opened again under the same id. Reopening the radius dialog straight through the host left the new opening with no record, so its Cancel never cleared the open dialog (a_second_click_replaces_the_open_dialog failed). The dialog now opens the replacement with open_held_with, which gives it its own OK and cancel hook. --- .../src/addons/pathtools/tangent_circle_radius.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/src/addons/pathtools/tangent_circle_radius.rs b/crates/ui-egui/src/addons/pathtools/tangent_circle_radius.rs index 7a58e65095..92ad231a96 100644 --- a/crates/ui-egui/src/addons/pathtools/tangent_circle_radius.rs +++ b/crates/ui-egui/src/addons/pathtools/tangent_circle_radius.rs @@ -51,16 +51,13 @@ pub(crate) fn open(app: &mut VectorcraftApp, p: &Value) { return; }; // A dialog still open from an earlier click closes without an answer, and its preview is rolled back. The new - // dialog has its id (the dialog's kind), so the earlier dialog's held answer, with its OK and cancel hook, serves - // the new one. - let mut held = None; + // dialog has the same id (the dialog's kind), and its own held answer and cancel hook replace the earlier ones. if let Some(mut old) = app.addon_dialogs.tangent_radius.take() { if let Some(host) = app.dialogs() { host.with(|h| { h.cancel_by_id(&ctx, old.id); let _ = h.take_by_id::(old.id); }); - held = Some(host); } take_preview(app, &mut old).cancel(app); } @@ -76,11 +73,7 @@ pub(crate) fn open(app: &mut VectorcraftApp, p: &Value) { take_preview(app, &mut open).cancel(app); } }); - let opened = match held { - Some(host) => Some(host.with(|h| h.open(dialog.held_ok()))), - None => open_held_with(app, dialog, ok, HeldOptions { parent: None, cancel: Some(cancel) }), - }; - match opened { + match open_held_with(app, dialog, ok, HeldOptions { parent: None, cancel: Some(cancel) }) { Some(id) => { app.addon_dialogs.tangent_radius = Some(Open { id, click: p.clone(), doc, tried: None, note: None, preview: LivePreview::default(), shown_in: doc });