From 9de2760deefe87299cdf0060d336b5a3d18a1b7e Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 12 Jun 2026 14:07:57 +0300 Subject: [PATCH] fix(selection): keep active selection on empty box/lasso An empty box or lasso drag called deselect_all, discarding a selection the user may have built up over several picks. Drop the empty-clear from the lasso and two-click box paths so a stray empty drag leaves the selection untouched; Esc remains the deliberate clear. (issue #83) Co-Authored-By: Claude Opus 4.8 --- src/app/update.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/app/update.rs b/src/app/update.rs index 5e11fd210..f46dcd805 100644 --- a/src/app/update.rs +++ b/src/app/update.rs @@ -3396,14 +3396,13 @@ impl OpenCADStudio { // Selection filter: keep only allowed types. handles.retain(|&h| self.tabs[i].scene.passes_selection_filter(h)); // Accumulate like the box path (issue #83): plain - // lasso adds, Shift+lasso removes, an empty lasso - // clears. + // lasso adds, Shift+lasso removes. An empty lasso + // leaves the current selection untouched so a stray + // drag never discards hard-won picks. if self.shift_down { for h in &handles { self.tabs[i].scene.deselect_entity(*h); } - } else if handles.is_empty() { - self.tabs[i].scene.deselect_all(); } else { for h in &handles { self.tabs[i].scene.select_entity(*h, false); @@ -3534,14 +3533,12 @@ impl OpenCADStudio { handles.retain(|&h| self.tabs[i].scene.passes_selection_filter(h)); // Accumulate (issue #83): a plain box adds to the // current selection, Shift+box removes the boxed - // entities, and an empty box clears (the two-click - // analogue of clicking empty space). + // entities. An empty box leaves the selection alone + // so an accidental empty drag never discards it. if self.shift_down { for h in &handles { self.tabs[i].scene.deselect_entity(*h); } - } else if handles.is_empty() { - self.tabs[i].scene.deselect_all(); } else { for h in &handles { self.tabs[i].scene.select_entity(*h, false);