# HG changeset patch # User Teemu Piippo # Date 1409557062 -10800 # Node ID 20108369330022ac9ec40853e58583713507eac1 # Parent 977099f224d0a8d75d697a1986c84dd568ffa7cd - circle mode now locks the angle offset on final confirmation stage diff -r 977099f224d0 -r 201083693300 src/editmodes/circleMode.cc --- 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; +} diff -r 977099f224d0 -r 201083693300 src/editmodes/circleMode.h --- 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();