forked from 1b-agent/opencadstudio-upstream
perf(clipboard): derive the paste anchor from bounding boxes
COPYCLIP/CUTCLIP computed the clipboard anchor by tessellating every selected entity and averaging all wire vertices — O(total geometry), ~250 ms when copying a whole drawing. The anchor only fixes which point of the selection sits under the cursor at paste, so the mean of each entity's bounding-box centre is an equally valid, far cheaper origin.
This commit is contained in:
1 parent
4d7588e1e0
commit
56835791af
2 files changed
+25
-25
No files matched your search
@@ -70,8 +70,9 @@ impl OpenCADStudio {
|
||||
.iter()
|
||||
.filter_map(|&h| self.tabs[i].scene.document.get_entity(h).cloned())
|
||||
.collect();
|
||||
self.clipboard_centroid = super::super::helpers::entities_centroid(
|
||||
&self.tabs[i].scene.wire_models_for(&handles),
|
||||
self.clipboard_centroid = super::super::helpers::entities_centroid_by_bbox(
|
||||
&self.tabs[i].scene.document,
|
||||
&handles,
|
||||
);
|
||||
self.clipboard = entities;
|
||||
self.clipboard_deps = super::super::ClipboardDeps::capture(
|
||||
@@ -158,8 +159,9 @@ impl OpenCADStudio {
|
||||
.iter()
|
||||
.filter_map(|&h| self.tabs[i].scene.document.get_entity(h).cloned())
|
||||
.collect();
|
||||
self.clipboard_centroid = super::super::helpers::entities_centroid(
|
||||
&self.tabs[i].scene.wire_models_for(&handles),
|
||||
self.clipboard_centroid = super::super::helpers::entities_centroid_by_bbox(
|
||||
&self.tabs[i].scene.document,
|
||||
&handles,
|
||||
);
|
||||
let count = entities.len();
|
||||
self.clipboard = entities;
|
||||
|
||||
Reference in new issue
Block a user