def GetRedrawRect(self, movex=0, movey=0):
parent_pos = self.ParentBlock.GetPosition()
x = min(parent_pos[0] + self.Pos.x, parent_pos[0] + self.Pos.x + self.Direction[0] * CONNECTOR_SIZE)
y = min(parent_pos[1] + self.Pos.y, parent_pos[1] + self.Pos.y + self.Direction[1] * CONNECTOR_SIZE)
has_modifier = self.Negated or self.Edge != "none"
if self.Direction[0] == 0:
width = 10 if has_modifier else 5
else:
width = CONNECTOR_SIZE
if self.Edge == "rising" and self.Direction[0] == 1:
x -= 5
width += 5
if self.Direction[1] == 0:
height = 10 if has_modifier else 5
else:
height = CONNECTOR_SIZE
if self.Edge == "rising" and self.Direction[1] == 1:
y -= 5
height += 5
rect = wx.Rect(x - abs(movex), y - abs(movey), width + 2 * abs(movex), height + 2 * abs(movey))
if self.ValueSize is None and isinstance(self.ComputedValue, (StringType, UnicodeType)):
self.ValueSize = self.ParentBlock.Parent.GetMiniTextExtent(self.ComputedValue)
if self.ValueSize is not None:
width, height = self.ValueSize
rect = rect.Union(
wx.Rect(
parent_pos[0] + self.Pos.x + CONNECTOR_SIZE * self.Direction[0] +
width * (self.Direction[0] - 1) / 2,
parent_pos[1] + self.Pos.y + CONNECTOR_SIZE * self.Direction[1] +
height * (self.Direction[1] - 1),
width, height))
return rect
# Change the connector selection
评论列表
文章目录