From 040b9e607bf4b481edbed297d38c62587c4a5296 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 16 Jan 2015 15:20:15 +0200 Subject: [PATCH] Method Mirror now should work. --HG-- branch : feature --- src/libs/vlayout/vlayoutdetail.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/libs/vlayout/vlayoutdetail.cpp b/src/libs/vlayout/vlayoutdetail.cpp index 610a617c9..a47144953 100644 --- a/src/libs/vlayout/vlayoutdetail.cpp +++ b/src/libs/vlayout/vlayoutdetail.cpp @@ -153,12 +153,16 @@ void VLayoutDetail::Mirror(const QLineF &edge) return; } - QLineF axis = QLineF(edge.x1(), edge.y1(), 100, edge.y2()); // Ox axis + const QLineF axis = QLineF(edge.x1(), edge.y1(), 100, edge.y2()); // Ox axis - qreal angle = edge.angleTo(axis); - Rotate(edge.p1(), -angle); - d->matrix *= d->matrix.scale(d->matrix.m11()*-1, d->matrix.m22()); - Rotate(edge.p1(), 360 + angle); + const qreal angle = edge.angleTo(axis); + QMatrix m; + m.translate(edge.p2().x(), edge.p2().y()); + m.rotate(-angle); + m.scale(m.m11(), m.m22()*-1); + m.rotate(360 - (-angle)); + m.translate(-edge.p2().x(), -edge.p2().y()); + d->matrix *= m; } //--------------------------------------------------------------------------------------------------------------------- @@ -323,7 +327,7 @@ QVector VLayoutDetail::Map(const QVector &points) const p.append(d->matrix.map(points.at(i))); } - if (d->matrix.m11() < 0) + if (d->matrix.m22() < 0) { QList list = p.toList(); for(int k=0, s=list.size(), max=(s/2); k