TRIM / EXTEND: a large cutting-edge selection no longer stalls each pick

In Standard mode the chosen edges sat in a Vec, and every trim rebuilt
the boundary by asking it about each object of the drawing: edges ×
objects per click, seconds once a crossing window picked thousands of
edges. Look them up in a set. TRIM's edge-selection hover also searched
all objects for every picked edge on each mouse move; it uses the
command's handle index like EXTEND.

Refs #1867

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-17 22:22:19 +03:00
1 parent 15a9051bb2
commit 4aa4b72d17
1 file changed
+10 -8
+10 -8
View File
@@ -2734,10 +2734,13 @@ impl TrimCommand {
self.geos = if self.edge_set.is_empty() {
build_geos(&self.all_entities)
} else {
// A set, not the Vec: every trim rebuilds this, and a selection
// of thousands of edges made it edges × objects per click (#1867).
let edges: std::collections::HashSet<Handle> = self.edge_set.iter().copied().collect();
let picked: Vec<EntityType> = self
.all_entities
.iter()
.filter(|e| self.edge_set.contains(&e.common().handle))
.filter(|e| edges.contains(&e.common().handle))
.cloned()
.collect();
build_geos(&picked)
@@ -3005,15 +3008,11 @@ impl CadCommand for TrimCommand {
let mut out: Vec<WireModel> = self
.edge_set
.iter()
.filter_map(|h| self.all_entities.iter().find(|e| e.common().handle == *h))
.filter_map(|h| self.entity_index.get(&self.all_entities, *h))
.map(|e| WireModel::solid("edge_sel".into(), entity_pts(e), OPT_YELLOW, false))
.collect();
if !handle.is_null() && !self.edge_set.contains(&handle) {
if let Some(e) = self
.all_entities
.iter()
.find(|e| e.common().handle == handle)
{
if let Some(e) = self.entity_index.get(&self.all_entities, handle) {
let mut c = OPT_YELLOW;
c[3] = 0.45;
out.push(WireModel::solid(
@@ -3480,10 +3479,13 @@ impl ExtendCommand {
self.geos = if self.edge_set.is_empty() {
build_geos(&self.all_entities)
} else {
// A set, not the Vec: every trim rebuilds this, and a selection
// of thousands of edges made it edges × objects per click (#1867).
let edges: std::collections::HashSet<Handle> = self.edge_set.iter().copied().collect();
let picked: Vec<EntityType> = self
.all_entities
.iter()
.filter(|e| self.edge_set.contains(&e.common().handle))
.filter(|e| edges.contains(&e.common().handle))
.cloned()
.collect();
build_geos(&picked)