- updated the Distance Tool such that the right click of the mouse will cancel the tool unless it was a panning move

- modified the PlotCanvasLegacy to decide if there is a mouse drag based on the distance between the press event position and the release event position. If the distance is smaller than a delta distance then it is not a drag move.
This commit is contained in:
Marius Stanciu
2020-05-13 00:59:35 +03:00
committed by Marius
parent 7ec3fa73af
commit 41922f5c7c
3 changed files with 25 additions and 7 deletions

View File

@@ -302,6 +302,8 @@ class PlotCanvasLegacy(QtCore.QObject):
# signal is the mouse is dragging
self.is_dragging = False
self.mouse_press_pos = None
# signal if there is a doubleclick
self.is_dblclk = False
@@ -327,7 +329,7 @@ class PlotCanvasLegacy(QtCore.QObject):
self.text_hud.remove_artist()
self.app.defaults['global_hud'] = False
self.canvas.draw()
class Thud(QtCore.QObject):
@@ -858,6 +860,7 @@ class PlotCanvasLegacy(QtCore.QObject):
def on_mouse_press(self, event):
self.is_dragging = True
self.mouse_press_pos = (event.x, event.y)
# Check for middle mouse button press
if self.app.defaults["global_pan_button"] == '2':
@@ -883,7 +886,11 @@ class PlotCanvasLegacy(QtCore.QObject):
def on_mouse_release(self, event):
self.is_dragging = False
mouse_release_pos = (event.x, event.y)
delta = 0.05
if abs(self.distance(self.mouse_press_pos, mouse_release_pos)) < delta:
self.is_dragging = False
# Check for middle mouse button release to complete pan procedure
# Check for middle mouse button press