graphics/GraphicCommons.py
changeset 395 d432eae889ed
parent 386 2049a2bd8017
child 398 c215899298c7
--- a/graphics/GraphicCommons.py	Wed Aug 12 14:23:33 2009 +0200
+++ b/graphics/GraphicCommons.py	Wed Aug 12 15:00:45 2009 +0200
@@ -2406,7 +2406,9 @@
         if event.ControlDown():
             direction = (self.StartPoint[1], self.EndPoint[1])
             if direction in [(EAST, WEST), (WEST, EAST)]:
-                avgy = round(float((self.StartPoint[0].y + self.EndPoint[0].y) / 2) / scaling[1]) * scaling[1]
+                avgy = (self.StartPoint[0].y + self.EndPoint[0].y) / 2
+                if scaling is not None:
+                    avgy = round(float(avgy) / scaling[1]) * scaling[1]
                 if self.StartConnected is not None:
                     movey = avgy - self.StartPoint[0].y
                     startblock = self.StartConnected.GetParentBlock()
@@ -2425,7 +2427,9 @@
                     self.MoveEndPoint(wx.Point(self.EndPoint[0].x, avgy))
                 self.Parent.RefreshBuffer()
             elif direction in [(NORTH, SOUTH), (SOUTH, NORTH)]:
-                avgx = round(float((self.StartPoint[0].x + self.EndPoint[0].x) / 2) / scaling[0]) * scaling[0]
+                avgx = (self.StartPoint[0].x + self.EndPoint[0].x) / 2
+                if scaling is not None:
+                    avgx = round(float(avgx) / scaling[0]) * scaling[0]
                 if self.StartConnected is not None:
                     movex = avgx - self.StartPoint[0].x
                     startblock = self.StartConnected.GetParentBlock()