From aa78043fa218389d0818b41df43dd184661a0859 Mon Sep 17 00:00:00 2001 From: Koen Schmeets Date: Fri, 27 Nov 2020 14:04:53 +0100 Subject: [PATCH] Swap vertical and horizontal constraints when rotating 90/270 degrees --- src/clipboard.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/clipboard.cpp b/src/clipboard.cpp index 011b658d..b02808d0 100644 --- a/src/clipboard.cpp +++ b/src/clipboard.cpp @@ -227,7 +227,6 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) { MakeSelected(hr.entity(j)); } } - Constraint *cc; for(cc = SS.clipboard.c.First(); cc; cc = SS.clipboard.c.NextAfter(cc)) { Constraint c = {}; @@ -257,7 +256,17 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) { case Constraint::Type::DIAMETER: c.valA *= fabs(scale); break; - + case Constraint::Type::HORIZONTAL: + case Constraint::Type::VERTICAL: + // When rotating 90 or 270 degrees, swap the vertical / horizontal constaints + if (theta == PI/2 || theta == PI*1.5) { + if(c.type == Constraint::Type::HORIZONTAL) { + c.type = Constraint::Type::VERTICAL; + } else { + c.type = Constraint::Type::HORIZONTAL; + } + } + break; default: break; }