Mon, 01 Sep 2014 10:37:42 +0300
- circle mode now locks the angle offset on final confirmation stage
src/editmodes/circleMode.cc | file | annotate | diff | comparison | revisions | |
src/editmodes/circleMode.h | file | annotate | diff | comparison | revisions |
--- a/src/editmodes/circleMode.cc Mon Sep 01 10:00:29 2014 +0300 +++ b/src/editmodes/circleMode.cc Mon Sep 01 10:37:42 2014 +0300 @@ -167,12 +167,11 @@ unless (objs.isEmpty()) { - Axis relZ = renderer()->getRelativeZ(); - const double angleoffset (-getAngleOffset()); + Axis relZ = renderer()->getRelativeZ();; const int l (relZ == X ? 1 : 0); const int m (relZ == Y ? 1 : 0); const int n (relZ == Z ? 1 : 0); - RotateObjects (l, m, n, angleoffset, objs); + RotateObjects (l, m, n, -m_angleOffset, objs); } finishDraw (objs); @@ -180,6 +179,9 @@ double CircleMode::getAngleOffset() const { + if (m_drawedVerts.isEmpty()) + return 0.0; + const int divisions (g_win->ringToolHiRes() ? HighResolution : LowResolution); QPointF originspot (renderer()->coordconv3_2 (m_drawedVerts.first())); QLineF bearing (originspot, renderer()->mousePositionF()); @@ -212,7 +214,7 @@ const double angleUnit (2 * Pi / divisions); Axis relX, relY; renderer()->getRelativeAxes (relX, relY); - const double angleoffset (getAngleOffset()); + const double angleoffset (m_drawedVerts.size() < 3 ? getAngleOffset() : m_angleOffset); // Calculate the preview positions of vertices for (int i = 0; i < segments + 1; ++i) @@ -305,3 +307,9 @@ return false; } + +bool CircleMode::preAddVertex (const Vertex&) +{ + m_angleOffset = getAngleOffset(); + return false; +}
--- a/src/editmodes/circleMode.h Mon Sep 01 10:00:29 2014 +0300 +++ b/src/editmodes/circleMode.h Mon Sep 01 10:37:42 2014 +0300 @@ -22,6 +22,7 @@ class CircleMode : public AbstractDrawMode { DEFINE_CLASS (CircleMode, AbstractDrawMode) + double m_angleOffset; public: CircleMode (GLRenderer* renderer); @@ -32,6 +33,7 @@ double getCircleDrawDist (int pos) const; Matrix getCircleDrawMatrix (double scale); bool mouseReleased (const AbstractEditMode::MouseEventData& data) override; + bool preAddVertex (Vertex const&) override; private: void buildCircle();