From 5d87535f2f11de1c8ccebc8db926c69437f7f866 Mon Sep 17 00:00:00 2001 From: daid303 Date: Mon, 4 Feb 2013 10:04:23 +0100 Subject: [PATCH] Fix the number display on the scale tool, and make the scaling ticks depend on the whole scale, not the current extra factor. --- Cura/gui/util/previewTools.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Cura/gui/util/previewTools.py b/Cura/gui/util/previewTools.py index cf7cbe56..033b3a4e 100644 --- a/Cura/gui/util/previewTools.py +++ b/Cura/gui/util/previewTools.py @@ -336,7 +336,19 @@ class toolScale(object): endPoint = [0,0,1] scale = self._lineLineCrossingDistOnLine(p0, p1, numpy.array([0,0,0], numpy.float32), numpy.array(endPoint, numpy.float32)) / 15.0 / s if not wx.GetKeyState(wx.WXK_SHIFT): - scale = round(scale * 10) / 10 + objMatrix = self.parent.getObjectMatrix() + scaleX = numpy.linalg.norm(objMatrix[0].getA().flatten()) + scaleY = numpy.linalg.norm(objMatrix[1].getA().flatten()) + scaleZ = numpy.linalg.norm(objMatrix[2].getA().flatten()) + if self.node == 1 or not wx.GetKeyState(wx.WXK_CONTROL): + matrixScale = (scaleX + scaleY + scaleZ) / 3 + elif self.node == 2: + matrixScale = scaleX + elif self.node == 3: + matrixScale = scaleY + elif self.node == 4: + matrixScale = scaleZ + scale = (round((matrixScale * scale) * 10) / 10) / matrixScale if scale < 0: scale = -scale if scale < 0.1: @@ -391,7 +403,9 @@ class toolScale(object): glTranslate(0, (radius + 5) * (90 - self.parent.pitch) / 10,0) else: glTranslate(0,-(radius + 5),0) - opengl.glDrawStringCenter("%dx%dx%d" % (size[0], size[1], size[2])) + if self.parent.tempMatrix is not None: + size = (numpy.matrix([size]) * self.parent.tempMatrix).getA().flatten() + opengl.glDrawStringCenter("%dx%dx%dmm" % (size[0], size[1], size[2])) glPopMatrix() glLineWidth(1) -- 2.30.2