Skip to content

Commit

Permalink
Fix GitHub Issue #239: Cannot drag if the drag position is inside the…
Browse files Browse the repository at this point in the history
… virtual rectangle spanned by an edge
  • Loading branch information
juzzlin committed Mar 14, 2023
1 parent 5269426 commit 0a3a772
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/editor_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/editor_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 0a3a772

Please sign in to comment.