feat(clipboard): carry referenced records across drawings on paste
Copy/paste between drawings dropped the entities' layer (and linetype / text + dim style): the clipboard held only the entities, which reference those records by name, so pasting into a drawing without a matching record left the entity dangling on a non-existent layer. (#129) Snapshot the referenced table records from the source drawing at copy time (ClipboardDeps::capture) and, on paste, recreate any the target drawing lacks with a fresh handle (merge_clipboard_deps). A record that already exists by name in the target is left untouched — the target's own definition wins; only missing ones are imported from the source. Same-document pastes are unaffected (every record already exists). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
5ce3aaf260
commit
70e73877b2
3 changed files with 132 additions and 0 deletions
|
|
@ -527,6 +527,10 @@ impl OpenCADStudio {
|
|||
&self.tabs[i].scene.wire_models_for(&handles),
|
||||
);
|
||||
self.clipboard = entities;
|
||||
self.clipboard_deps = super::ClipboardDeps::capture(
|
||||
&self.tabs[i].scene.document,
|
||||
&self.clipboard,
|
||||
);
|
||||
self.command_line.push_info(&format!(
|
||||
"{} object(s) copied to clipboard.",
|
||||
self.clipboard.len()
|
||||
|
|
@ -556,6 +560,10 @@ impl OpenCADStudio {
|
|||
);
|
||||
let count = entities.len();
|
||||
self.clipboard = entities;
|
||||
self.clipboard_deps = super::ClipboardDeps::capture(
|
||||
&self.tabs[i].scene.document,
|
||||
&self.clipboard,
|
||||
);
|
||||
self.push_undo_snapshot(i, "CUTCLIP");
|
||||
self.tabs[i].scene.erase_entities(&handles);
|
||||
self.tabs[i].scene.deselect_all();
|
||||
|
|
|
|||
Loading…
Reference in a new issue