From 5af252eaf1871072d68a852a2f21e309c574624c Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 19 Jul 2016 12:12:01 +0000 Subject: [PATCH] Multiply constraint values by scale when pasting with transformation. --- CHANGELOG.md | 1 + src/clipboard.cpp | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36374ae..c126a2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Bug fixes: * Three.js: correctly respond to controls when browser zoom is used. * OS X: do not completely hide main window when defocused. * GTK: unbreak 3Dconnexion support. + * When pasting transformed entities, multiply constraint values by scale. 2.1 --- diff --git a/src/clipboard.cpp b/src/clipboard.cpp index 2930596..c13b4fb 100644 --- a/src/clipboard.cpp +++ b/src/clipboard.cpp @@ -212,9 +212,24 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) { c.reference = cc->reference; c.disp = cc->disp; c.comment = cc->comment; + switch(c.type) { + case Constraint::COMMENT: + c.disp.offset = c.disp.offset.Plus(trans); + break; + + case Constraint::PT_PT_DISTANCE: + case Constraint::PT_LINE_DISTANCE: + case Constraint::PROJ_PT_DISTANCE: + case Constraint::DIAMETER: + c.valA *= fabs(scale); + break; + + default: + break; + } + hConstraint hc = Constraint::AddConstraint(&c, /*rememberForUndo=*/false); if(c.type == Constraint::COMMENT) { - SK.GetConstraint(hc)->disp.offset = SK.GetConstraint(hc)->disp.offset.Plus(trans); MakeSelected(hc); } }