def RefreshBoundingBox(self):
bbx_x, bbx_y, bbx_width, bbx_height = self.Pos.x, self.Pos.y, self.Size[0], self.Size[1]
if self.Priority != 0:
bbx_y = self.Pos.y - self.PrioritySize[1] - 2
bbx_width = max(self.Size[0], self.PrioritySize[0])
bbx_height = self.Size[1] + self.PrioritySize[1] + 2
if self.Type == "connection":
bbx_x = self.Pos.x - CONNECTOR_SIZE
bbx_width = bbx_width + CONNECTOR_SIZE
else:
text_width, text_height = self.ConditionSize
# Calculate the bounding box size
bbx_width = max(bbx_width, self.Size[0] + 5 + text_width)
bbx_y = min(bbx_y, self.Pos.y - max(0, (text_height - self.Size[1]) / 2))
bbx_height = max(bbx_height, self.Pos.y - bbx_y + (self.Size[1] + text_height) / 2)
self.BoundingBox = wx.Rect(bbx_x, bbx_y, bbx_width + 1, bbx_height + 1)
# Returns the connector connected to input
评论列表
文章目录