fix(scene): clear selection after erase

This commit is contained in:
Hakan Seven committed 2026-07-28 17:35:21 +03:00
1 parent 05b044f367
commit 8050fc79fd
7 files changed
+50 -11

No files matched your search

+3 -1
View File
@@ -334,7 +334,9 @@ impl OpenCADStudio {
n += 1;
}
// Draw the text in front of its newly-added masks.
self.tabs[i].scene.selected = handles.iter().cloned().collect();
self.tabs[i]
.scene
.replace_selection(handles.iter().cloned().collect());
self.tabs[i].dirty = true;
self.command_line
.push_output(&format!("TEXTMASK: masked {n} text object(s)."));
+1 -1
View File
@@ -754,7 +754,7 @@ impl OpenCADStudio {
.push_info(&format!("{cmd}: no text or dimension objects."));
return Some(Task::none());
}
self.tabs[i].scene.selected = handles;
self.tabs[i].scene.replace_selection(handles);
return self.dispatch_view(
if to_front {
"DRAWORDER FRONT"
+14 -6
View File
@@ -875,7 +875,13 @@ impl OpenCADStudio {
.copied()
.filter(|h| scene.document.get_entity(*h).is_some())
.collect();
scene.selected = restored;
scene.replace_selection(restored);
if scene
.hover_highlight
.is_some_and(|handle| scene.document.get_entity(handle).is_none())
{
scene.set_hover_highlight(None);
}
// Entity deltas currently preserve the layout; direct assignment avoids
// clearing layout render caches between steps and keeps future widened
// deltas batchable.
@@ -903,11 +909,13 @@ impl OpenCADStudio {
let mut affected = scene.object_isolation.hidden.clone();
affected.extend(state.hidden.iter().copied());
scene.object_isolation = state.clone();
scene.selected = selected
.iter()
.copied()
.filter(|handle| scene.document.get_entity(*handle).is_some())
.collect();
scene.replace_selection(
selected
.iter()
.copied()
.filter(|handle| scene.document.get_entity(*handle).is_some())
.collect(),
);
let changes: Vec<_> = affected
.into_iter()
.map(|handle| (handle, crate::scene::ChangeKind::Modified))
+3 -1
View File
@@ -801,7 +801,9 @@ pub(super) fn on_open_file(&mut self) -> Task<Message> {
if let Some(prepared) = prepared_geometry {
self.tabs[i].scene.install_prepared_open_geometry(prepared);
}
self.tabs[i].scene.selected = rustc_hash::FxHashSet::default();
self.tabs[i]
.scene
.replace_selection(rustc_hash::FxHashSet::default());
self.tabs[i].scene.preview_wires = vec![];
// Reopen in whichever space the file was saved in — the CTAB
// tab name when recorded, else the $TILEMODE model/paper flag —