def RefreshHighlight(self, x, y):
"""
Refresh Viewer highlight according to mouse position
@param x: X coordinate of mouse pointer
@param y: Y coordinate of mouse pointer
"""
width, height = self.GetSize()
# Mouse is over Viewer figure and graph is not 3D
bbox = self.GetAxesBoundingBox()
if bbox.InsideXY(x, y) and not self.Is3DCanvas():
rect = wx.Rect(bbox.x, bbox.y, bbox.width / 2, bbox.height)
# Mouse is over Viewer left part of figure
if rect.InsideXY(x, y):
self.SetHighlight(HIGHLIGHT_LEFT)
# Mouse is over Viewer right part of figure
else:
self.SetHighlight(HIGHLIGHT_RIGHT)
# Mouse is over upper part of Viewer
elif y < height / 2:
# Viewer is upper one in Debug Variable Panel, show highlight
if self.ParentWindow.IsViewerFirst(self):
self.SetHighlight(HIGHLIGHT_BEFORE)
# Viewer is not the upper one, show highlight in previous one
# It prevents highlight to move when mouse leave one Viewer to
# another
else:
self.SetHighlight(HIGHLIGHT_NONE)
self.ParentWindow.HighlightPreviousViewer(self)
# Mouse is over lower part of Viewer
else:
self.SetHighlight(HIGHLIGHT_AFTER)
评论列表
文章目录