graphics/FBD_Objects.py
branchwxPython4
changeset 3303 0ffb41625592
parent 2437 105c20fdeb19
child 3537 cb7db021280c
equal deleted inserted replaced
3302:c89fc366bebd 3303:0ffb41625592
   120         self.ExecutionOrderSize = self.Parent.GetTextExtent(str(self.ExecutionOrder))
   120         self.ExecutionOrderSize = self.Parent.GetTextExtent(str(self.ExecutionOrder))
   121 
   121 
   122     # Returns if the point given is in the bounding box
   122     # Returns if the point given is in the bounding box
   123     def HitTest(self, pt, connectors=True):
   123     def HitTest(self, pt, connectors=True):
   124         if self.Name != "":
   124         if self.Name != "":
   125             test_text = self.GetTextBoundingBox().InsideXY(pt.x, pt.y)
   125             test_text = self.GetTextBoundingBox().Contains(pt.x, pt.y)
   126         else:
   126         else:
   127             test_text = False
   127             test_text = False
   128         test_block = self.GetBlockBoundingBox(connectors).InsideXY(pt.x, pt.y)
   128         test_block = self.GetBlockBoundingBox(connectors).Contains(pt.x, pt.y)
   129         return test_text or test_block
   129         return test_text or test_block
   130 
   130 
   131     # Returns the bounding box of the name outside the block
   131     # Returns the bounding box of the name outside the block
   132     def GetTextBoundingBox(self):
   132     def GetTextBoundingBox(self):
   133         # Calculate the size of the name outside the block
   133         # Calculate the size of the name outside the block
   390 #    def OnMotion(self, event, dc, scaling):
   390 #    def OnMotion(self, event, dc, scaling):
   391 #        if not event.Dragging():
   391 #        if not event.Dragging():
   392 #            pos = event.GetLogicalPosition(dc)
   392 #            pos = event.GetLogicalPosition(dc)
   393 #            for input in self.Inputs:
   393 #            for input in self.Inputs:
   394 #                rect = input.GetRedrawRect()
   394 #                rect = input.GetRedrawRect()
   395 #                if rect.InsideXY(pos.x, pos.y):
   395 #                if rect.Contains(pos.x, pos.y):
   396 #                    print "Find input"
   396 #                    print "Find input"
   397 #                    tip = wx.TipWindow(self.Parent, "Test")
   397 #                    tip = wx.TipWindow(self.Parent, "Test")
   398 #                    tip.SetBoundingRect(rect)
   398 #                    tip.SetBoundingRect(rect)
   399 #        return Graphic_Element.OnMotion(self, event, dc, scaling)
   399 #        return Graphic_Element.OnMotion(self, event, dc, scaling)
   400 
   400