src/editmodes/rectangleMode.cpp

changeset 1390
3eace926af7f
parent 1326
69a90bd2dba2
child 1392
0541d9b21968
--- a/src/editmodes/rectangleMode.cpp	Sat May 26 17:28:15 2018 +0300
+++ b/src/editmodes/rectangleMode.cpp	Wed May 30 22:31:06 2018 +0300
@@ -78,16 +78,16 @@
 	Axis localx, localy, localz;
 	renderer()->getRelativeAxes(localx, localy);
 	localz = renderer()->getRelativeZ();
-
-	for (int i = 0; i < 4; ++i)
-		m_rectangleVerts[i].setCoordinate (localz, renderer()->getDepthValue());
+	m_rectangleVerts[0].setCoordinate(localx, v0[localx]);
+	m_rectangleVerts[0].setCoordinate(localy, v0[localy]);
+	m_rectangleVerts[1].setCoordinate(localx, v1[localx]);
+	m_rectangleVerts[1].setCoordinate(localy, v0[localy]);
+	m_rectangleVerts[2].setCoordinate(localx, v1[localx]);
+	m_rectangleVerts[2].setCoordinate(localy, v1[localy]);
+	m_rectangleVerts[3].setCoordinate(localx, v0[localx]);
+	m_rectangleVerts[3].setCoordinate(localy, v1[localy]);
 
-	m_rectangleVerts[0].setCoordinate (localx, v0[localx]);
-	m_rectangleVerts[0].setCoordinate (localy, v0[localy]);
-	m_rectangleVerts[1].setCoordinate (localx, v1[localx]);
-	m_rectangleVerts[1].setCoordinate (localy, v0[localy]);
-	m_rectangleVerts[2].setCoordinate (localx, v1[localx]);
-	m_rectangleVerts[2].setCoordinate (localy, v1[localy]);
-	m_rectangleVerts[3].setCoordinate (localx, v0[localx]);
-	m_rectangleVerts[3].setCoordinate (localy, v1[localy]);
+	// Compute local z from the draw plane
+	for (int i = 0; i < 4; ++i)
+		m_rectangleVerts[i] = projectToDrawPlane(m_rectangleVerts[i]);
 }

mercurial