src/editmodes/circlemode.cc

changeset 824
6add2126e7ff
parent 823
1a2f593f0c02
child 825
f7649c9bfd9a
--- a/src/editmodes/circlemode.cc	Fri Jul 04 22:19:01 2014 +0300
+++ b/src/editmodes/circlemode.cc	Fri Jul 04 22:40:35 2014 +0300
@@ -43,6 +43,8 @@
 
 void CircleMode::render (QPainter& painter) const
 {
+	QFontMetrics const metrics (QFont());
+
 	// If we have not specified the center point of the circle yet, preview it on the screen.
 	if (m_drawedVerts.isEmpty())
 	{
@@ -121,7 +123,7 @@
 		// Draw the current radius in the middle of the circle.
 		QPoint origin = renderer()->coordconv3_2 (m_drawedVerts[0]);
 		QString label = QString::number (dist0);
-		painter.setPen (textpen);
+		painter.setPen (renderer()->getTextPen());
 		painter.drawText (origin.x() - (metrics.width (label) / 2), origin.y(), label);
 
 		if (m_drawedVerts.size() >= 2)
@@ -130,4 +132,18 @@
 				origin.y() + metrics.height(), QString::number (dist1));
 		}
 	}
-}
\ No newline at end of file
+}
+
+bool CircleMode::mouseReleased (MouseEventData const& data)
+{
+	if (Super::mouseReleased (data))
+		return true;
+
+	if (m_drawedVerts.size() < 3)
+	{
+		addDrawnVertex (m_position3D);
+		return;
+	}
+
+	Super::mouseReleased (data);
+}

mercurial