Bug when aligning blocks on wire connectors without scaling defined fixed
authorlaurent
Wed, 12 Aug 2009 15:00:45 +0200
changeset 395 d432eae889ed
parent 394 2e9fc0ad6095
child 396 9089bc4a92e5
child 413 127d524a5f1d
Bug when aligning blocks on wire connectors without scaling defined fixed
graphics/GraphicCommons.py
--- 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()