Copy, cut and paste sketch geometry (Ctrl+C/X/V, context menu) (#1500)
* Copy, cut and paste sketch geometry (Ctrl+C/X/V, context menu) Sketch geometry had no copy or paste: Ctrl+C / Ctrl+X / Ctrl+V arrive as clipboard events that nothing handled, and the sketch context menu had no Copy, Cut or Paste. - sketch.copy / sketch.cut / sketch.paste: lines, arcs, circles, ellipses, splines, conics, points and text. Constraints and dimensions wholly among the copied entities come along (each dimension gets its own parameter with the same expression); ones that reach outside, fixes and pattern or offset relations are dropped. Paste goes centred at `at`, by `translate`, or offset from the original (same sketch) / at the same coordinates (another sketch, on its plane). One undo step; the pasted geometry is selected. - Ctrl+C / Ctrl+X / Ctrl+V in a sketch (paste at the cursor), and Cut, Copy and Paste in the sketch context menu. Outside a sketch Ctrl+C / Ctrl+V copy and paste the selected timeline features. A copy also puts a line of text on the system clipboard so the next Ctrl+V is delivered. Fixes #1480 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep a pasted text's height and angle expressions, drop its place's Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7934edcad4
commit
843c548589
20 files changed
+981
-8
No files matched your search
@@ -756,6 +756,8 @@ fn sketch_entity_items(app: &SolveApp) -> Vec<Item> {
|
||||
v.push(cmd(app, "sketch.rectangle.two_point", "Rectangle"));
|
||||
v.push(cmd(app, "sketch.circle.center", "Circle"));
|
||||
v.push(cmd(app, "sketch.dimension", "Sketch Dimension"));
|
||||
v.push(Item::sep());
|
||||
v.push(act("ui.paste", "Paste", "").key("Ctrl+V").on(app.session.sketch_clipboard.is_some()));
|
||||
return v;
|
||||
}
|
||||
let ents: Vec<String> = curves.iter().chain(points.iter()).cloned().collect();
|
||||
@@ -770,6 +772,9 @@ fn sketch_entity_items(app: &SolveApp) -> Vec<Item> {
|
||||
v.push(cmd(app, "sketch.edit_text", "Edit Text"));
|
||||
}
|
||||
v.push(cmd(app, "sketch.move", "Move/Copy").key("M"));
|
||||
v.push(act("ui.cut", "Cut", "").key("Ctrl+X"));
|
||||
v.push(act("ui.copy", "Copy", "").key("Ctrl+C"));
|
||||
v.push(act("ui.paste", "Paste", "").key("Ctrl+V").on(app.session.sketch_clipboard.is_some()));
|
||||
if !curves.is_empty() {
|
||||
v.push(cmd(app, "sketch.construction", "Normal / Construction").with(json!({ "curves": curves })));
|
||||
}
|
||||
@@ -852,6 +857,9 @@ pub fn run_item(app: &mut SolveApp, item: &Item, at: Pos2) {
|
||||
"ui.delete" if item.params.is_some() => crate::delete::request(app, p),
|
||||
"ui.delete" => delete(app),
|
||||
"ui.finishSketch" => app.finish_sketch(),
|
||||
"ui.copy" => drop(crate::edit_clipboard::copy(app)),
|
||||
"ui.cut" => drop(crate::edit_clipboard::cut(app)),
|
||||
"ui.paste" => drop(crate::edit_clipboard::paste(app, Some(at))),
|
||||
"ui.editSketchPattern" => {
|
||||
if let Some(id) = p.get("pattern").and_then(Value::as_str) {
|
||||
crate::sketch_modify_ui::edit_pattern(app, id);
|
||||
|
||||
Reference in new issue
Block a user