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:
parent
4d7588e1e0
commit
56835791af
2 changed files with 25 additions and 25 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue