def __init__(self, graph):
ViewBox.__init__(self, enableMenu=False)
self.graph = graph
self.setMouseMode(self.PanMode)
self.zoomstartpoint = None
self.current_selection = None
self.action = PANNING
self.y_padding = 0.02
self.x_padding = 0
# line for marking selection
self.selection_line = pg.PlotCurveItem()
self.selection_line.setPen(pg.mkPen(color=QColor(Qt.black), width=2, style=Qt.DotLine))
self.selection_line.setZValue(1e9)
self.selection_line.hide()
self.addItem(self.selection_line, ignoreBounds=True)
# yellow marker for ending the polygon
self.selection_poly_marker = pg.ScatterPlotItem()
self.selection_poly_marker.setPen(pg.mkPen(color=QColor(Qt.yellow), width=2))
self.selection_poly_marker.setSize(SELECT_POLYGON_TOLERANCE*2)
self.selection_poly_marker.setBrush(None)
self.selection_poly_marker.setZValue(1e9+1)
self.selection_poly_marker.hide()
self.selection_poly_marker.mouseClickEvent = lambda x: x # ignore mouse clicks
self.addItem(self.selection_poly_marker, ignoreBounds=True)
评论列表
文章目录