Browse Source

Fix for unconventional mouse releases while line is dragging

Closes #880

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc2
falkTX 4 years ago
parent
commit
991b184ddb
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 6 additions and 4 deletions
  1. +6
    -1
      source/frontend/patchcanvas/canvasport.py
  2. +0
    -3
      source/frontend/patchcanvas/scene.py

+ 6
- 1
source/frontend/patchcanvas/canvasport.py View File

@@ -147,6 +147,8 @@ class CanvasPort(QGraphicsItem):
QGraphicsItem.hoverLeaveEvent(self, event) QGraphicsItem.hoverLeaveEvent(self, event)


def mousePressEvent(self, event): def mousePressEvent(self, event):
if self.m_mouse_down:
self.handleMouseRelease()
self.m_hover_item = None self.m_hover_item = None
self.m_mouse_down = bool(event.button() == Qt.LeftButton) self.m_mouse_down = bool(event.button() == Qt.LeftButton)
self.m_cursor_moving = False self.m_cursor_moving = False
@@ -209,7 +211,7 @@ class CanvasPort(QGraphicsItem):


self.m_line_mov.updateLinePos(event.scenePos()) self.m_line_mov.updateLinePos(event.scenePos())


def mouseReleaseEvent(self, event):
def handleMouseRelease(self):
if self.m_mouse_down: if self.m_mouse_down:
if self.m_line_mov is not None: if self.m_line_mov is not None:
item = self.m_line_mov item = self.m_line_mov
@@ -265,6 +267,9 @@ class CanvasPort(QGraphicsItem):
self.m_hover_item = None self.m_hover_item = None
self.m_mouse_down = False self.m_mouse_down = False
self.m_cursor_moving = False self.m_cursor_moving = False

def mouseReleaseEvent(self, event):
self.handleMouseRelease()
QGraphicsItem.mouseReleaseEvent(self, event) QGraphicsItem.mouseReleaseEvent(self, event)


def contextMenuEvent(self, event): def contextMenuEvent(self, event):


+ 0
- 3
source/frontend/patchcanvas/scene.py View File

@@ -374,14 +374,11 @@ class PatchScene(QGraphicsScene):
self.m_mouse_rubberband = False self.m_mouse_rubberband = False


if event.button() == Qt.MidButton: if event.button() == Qt.MidButton:
event.accept()

self.m_mid_button_down = False self.m_mid_button_down = False


# Connection cut mode off # Connection cut mode off
if self.m_ctrl_down: if self.m_ctrl_down:
self.m_view.viewport().unsetCursor() self.m_view.viewport().unsetCursor()
return


QGraphicsScene.mouseReleaseEvent(self, event) QGraphicsScene.mouseReleaseEvent(self, event)




Loading…
Cancel
Save