Exemplo n.º 1
0
    def mouseMoveEvent(self, event: Qt.QMouseEvent):
        if self.dragging:
            scale_factor = self.scale / self.fig.get_dpi()
            self.center[0] -= (event.x() - self.drag_start[0]) * scale_factor
            self.center[1] += (event.y() - self.drag_start[1]) * scale_factor
            self.drag_start = (event.x(), event.y())

            self.do_update = True
            # self.update_plot()
            self.center_changed.emit(self.center)
Exemplo n.º 2
0
 def mousePressEvent(self, event: Qt.QMouseEvent):
     if event.buttons() & QtCore.Qt.MiddleButton:
         self.dragging = True
         self.drag_start = (event.x(), event.y())