diff --git a/CHANGELOG.md b/CHANGELOG.md index a44126b..3b84f47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ Bugs fixed: on top of all other geometry. * A step rotate/translate group using a group forced to triangle mesh as a source group also gets forced to triangle mesh. + * Paste Transformed with a negative scale does not invert arcs. 2.3 --- diff --git a/src/clipboard.cpp b/src/clipboard.cpp index bbdf33e..8753e03 100644 --- a/src/clipboard.cpp +++ b/src/clipboard.cpp @@ -161,6 +161,23 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) { n = wrkpln->NormalN(), p = SK.GetEntity(wrkpl->point[0])->PointGetNum(); + // For arcs, reflection involves swapping the endpoints, or otherwise + // the arc gets inverted. + auto mapPoint = [scale](hEntity he) { + if(scale < 0) { + hRequest hr = he.request(); + Request *r = SK.GetRequest(hr); + if(r->type == Request::Type::ARC_OF_CIRCLE) { + if(he.v == hr.entity(2).v) { + return hr.entity(3); + } else if(he.v == hr.entity(3).v) { + return hr.entity(2); + } + } + } + return he; + }; + ClipboardRequest *cr; for(cr = SS.clipboard.r.First(); cr; cr = SS.clipboard.r.NextAfter(cr)) { hRequest hr = AddRequest(cr->type, /*rememberForUndo=*/false); @@ -194,7 +211,7 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) { pt = pt.RotatedAbout(n, theta); pt = pt.Plus(trans); int j = (r->type == Request::Type::DATUM_POINT) ? i : i + 1; - SK.GetEntity(hr.entity(j))->PointForceTo(pt); + SK.GetEntity(mapPoint(hr.entity(j)))->PointForceTo(pt); } if(hasDistance) { SK.GetEntity(hr.entity(64))->DistanceForceTo( @@ -216,8 +233,8 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) { c.workplane = SS.GW.ActiveWorkplane(); c.type = cc->type; c.valA = cc->valA; - c.ptA = SS.clipboard.NewEntityFor(cc->ptA); - c.ptB = SS.clipboard.NewEntityFor(cc->ptB); + c.ptA = SS.clipboard.NewEntityFor(mapPoint(cc->ptA)); + c.ptB = SS.clipboard.NewEntityFor(mapPoint(cc->ptB)); c.entityA = SS.clipboard.NewEntityFor(cc->entityA); c.entityB = SS.clipboard.NewEntityFor(cc->entityB); c.entityC = SS.clipboard.NewEntityFor(cc->entityC);