graphics/SFC_Objects.py
branchwxPython4
changeset 3303 0ffb41625592
parent 2457 9deec258ab1a
child 3750 f62625418bff
equal deleted inserted replaced
3302:c89fc366bebd 3303:0ffb41625592
   717             text_width, text_height = self.ConditionSize
   717             text_width, text_height = self.ConditionSize
   718             text_bbx = wx.Rect(self.Pos.x + self.Size[0] + 5,
   718             text_bbx = wx.Rect(self.Pos.x + self.Size[0] + 5,
   719                                self.Pos.y + (self.Size[1] - text_height) // 2,
   719                                self.Pos.y + (self.Size[1] - text_height) // 2,
   720                                text_width,
   720                                text_width,
   721                                text_height)
   721                                text_height)
   722             test_text = text_bbx.InsideXY(pt.x, pt.y)
   722             test_text = text_bbx.Contains(pt.x, pt.y)
   723         else:
   723         else:
   724             test_text = False
   724             test_text = False
   725         return test_text or Graphic_Element.HitTest(self, pt, connectors)
   725         return test_text or Graphic_Element.HitTest(self, pt, connectors)
   726 
   726 
   727     # Refresh the transition bounding box
   727     # Refresh the transition bounding box
  1202         elif self.Type in [SELECTION_CONVERGENCE, SIMULTANEOUS_CONVERGENCE]:
  1202         elif self.Type in [SELECTION_CONVERGENCE, SIMULTANEOUS_CONVERGENCE]:
  1203             return len(self.Inputs)
  1203             return len(self.Inputs)
  1204 
  1204 
  1205     # Returns if the point given is in the bounding box
  1205     # Returns if the point given is in the bounding box
  1206     def HitTest(self, pt, connectors=True):
  1206     def HitTest(self, pt, connectors=True):
  1207         return self.BoundingBox.InsideXY(pt.x, pt.y) or self.TestConnector(pt, exclude=False) is not None
  1207         return self.BoundingBox.Contains(pt.x, pt.y) or self.TestConnector(pt, exclude=False) is not None
  1208 
  1208 
  1209     # Refresh the divergence bounding box
  1209     # Refresh the divergence bounding box
  1210     def RefreshBoundingBox(self):
  1210     def RefreshBoundingBox(self):
  1211         if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
  1211         if self.Type in [SELECTION_DIVERGENCE, SELECTION_CONVERGENCE]:
  1212             self.BoundingBox = wx.Rect(self.Pos.x,       self.Pos.y,
  1212             self.BoundingBox = wx.Rect(self.Pos.x,       self.Pos.y,
  1590         text_width, text_height = self.TargetSize
  1590         text_width, text_height = self.TargetSize
  1591         text_bbx = wx.Rect(self.Pos.x + self.Size[0] + 2,
  1591         text_bbx = wx.Rect(self.Pos.x + self.Size[0] + 2,
  1592                            self.Pos.y + (self.Size[1] - text_height) // 2,
  1592                            self.Pos.y + (self.Size[1] - text_height) // 2,
  1593                            text_width,
  1593                            text_width,
  1594                            text_height)
  1594                            text_height)
  1595         return text_bbx.InsideXY(pt.x, pt.y) or Graphic_Element.HitTest(self, pt, connectors)
  1595         return text_bbx.Contains(pt.x, pt.y) or Graphic_Element.HitTest(self, pt, connectors)
  1596 
  1596 
  1597     # Refresh the jump bounding box
  1597     # Refresh the jump bounding box
  1598     def RefreshBoundingBox(self):
  1598     def RefreshBoundingBox(self):
  1599         text_width, _text_height = self.Parent.GetTextExtent(self.Target)
  1599         text_width, _text_height = self.Parent.GetTextExtent(self.Target)
  1600         # Calculate the bounding box size
  1600         # Calculate the bounding box size