graphics/LD_Objects.py
changeset 243 c5da8b706cde
parent 237 097e8ee006cb
child 249 d8425712acef
--- a/graphics/LD_Objects.py	Wed Aug 27 16:55:16 2008 +0200
+++ b/graphics/LD_Objects.py	Wed Aug 27 16:56:25 2008 +0200
@@ -88,7 +88,7 @@
     # Forbids to select a power rail
     def HitTest(self, pt):
         if self.Parent.GetDrawingMode() == FREEDRAWING_MODE:
-            return Graphic_Element.HitTest(self, pt) or self.TestConnector(pt, False) != None
+            return Graphic_Element.HitTest(self, pt) or self.TestConnector(pt, exclude=False) != None
         return False
     
     # Forbids to select a power rail
@@ -241,9 +241,9 @@
         return [connector for connector in self.Connectors if connector]
     
     # Test if point given is on one of the power rail connectors
-    def TestConnector(self, pt, exclude=True):
+    def TestConnector(self, pt, direction = None, exclude = True):
         for connector in self.Connectors:
-            if connector and connector.TestPoint(pt, exclude):
+            if connector and connector.TestPoint(pt, direction, exclude):
                 return connector
         return None
     
@@ -281,7 +281,7 @@
     def OnRightDown(self, event, dc, scaling):
         pos = GetScaledEventPosition(event, dc, scaling)
         # Test if a connector have been handled
-        connector = self.TestConnector(pos, False)
+        connector = self.TestConnector(pos, exclude=False)
         if connector:
             self.Handle = (HANDLE_CONNECTOR, connector)
             self.Parent.SetCursor(wx.StockCursor(wx.CURSOR_HAND))
@@ -495,12 +495,12 @@
         return {"input":self.Input,"output":self.Output}
     
     # Test if point given is on contact input or output connector
-    def TestConnector(self, pt, exclude=True):
+    def TestConnector(self, pt, direction = None, exclude=True):
         # Test input connector
-        if self.Input.TestPoint(pt, exclude):
+        if self.Input.TestPoint(pt, direction, exclude):
             return self.Input
         # Test output connector
-        if self.Output.TestPoint(pt, exclude):
+        if self.Output.TestPoint(pt, direction, exclude):
             return self.Output
         return None
 
@@ -747,12 +747,12 @@
         return {"input":self.Input,"output":self.Output}
     
     # Test if point given is on coil input or output connector
-    def TestConnector(self, pt, exclude=True):
+    def TestConnector(self, pt, direction = None, exclude=True):
         # Test input connector
-        if self.Input.TestPoint(pt, exclude):
+        if self.Input.TestPoint(pt, direction, exclude):
             return self.Input
         # Test output connector
-        if self.Output.TestPoint(pt, exclude):
+        if self.Output.TestPoint(pt, direction, exclude):
             return self.Output
         return None