From 0a3a7728d7a21c6a4ee4e2f166c30d29197ce77c Mon Sep 17 00:00:00 2001 From: Jussi Lind Date: Tue, 14 Mar 2023 21:33:56 +0200 Subject: [PATCH] Fix GitHub Issue #239: Cannot drag if the drag position is inside the virtual rectangle spanned by an edge --- CHANGELOG | 2 ++ src/editor_view.cpp | 9 +++++++-- src/editor_view.hpp | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 75bb32f2..2b0a0e4b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,8 @@ New features: Bug fixes: +* Fix GitHub Issue #239: Cannot drag if the drag position is inside the virtual rectangle spanned by an edge + Other: 4.0.0 diff --git a/src/editor_view.cpp b/src/editor_view.cpp index 17521736..7b7621e8 100644 --- a/src/editor_view.cpp +++ b/src/editor_view.cpp @@ -99,11 +99,13 @@ void EditorView::handleMousePressEventOnBackground(QMouseEvent & event) } } -void EditorView::handleMousePressEventOnEdge(QMouseEvent & event, EdgeR edge) +bool EditorView::handleMousePressEventOnEdge(QMouseEvent & event, EdgeR edge) { if (m_controlStrategy.secondaryButtonClicked(event)) { handleSecondaryButtonClickOnEdge(edge); + return true; } + return false; } void EditorView::handleMousePressEventOnNode(QMouseEvent & event, NodeR node) @@ -303,7 +305,10 @@ void EditorView::mousePressEvent(QMouseEvent * event) if (const auto result = ItemFilter::getFirstItemAtPosition(*scene(), clickedScenePos, Constants::View::CLICK_TOLERANCE); result.success) { if (result.edge) { juzzlin::L().debug() << "Edge pressed"; - handleMousePressEventOnEdge(*event, *result.edge); + if (!handleMousePressEventOnEdge(*event, *result.edge)) { + juzzlin::L().debug() << "Background pressed via edge"; + handleMousePressEventOnBackground(*event); + } } else if (result.nodeHandle) { juzzlin::L().debug() << "Node handle pressed"; handleMousePressEventOnNodeHandle(*event, *result.nodeHandle); diff --git a/src/editor_view.hpp b/src/editor_view.hpp index 4e70dcaa..f3d9dc1b 100644 --- a/src/editor_view.hpp +++ b/src/editor_view.hpp @@ -118,7 +118,8 @@ public slots: void handleMousePressEventOnBackground(QMouseEvent & event); - void handleMousePressEventOnEdge(QMouseEvent & event, EdgeR edge); + //! \returns true if accepted. + bool handleMousePressEventOnEdge(QMouseEvent & event, EdgeR edge); void handleMousePressEventOnNode(QMouseEvent & event, NodeR node);