Skip to content

Commit

Permalink
[controls] SelectionBox: Setting the drag.smoothed property to false …
Browse files Browse the repository at this point in the history
…when the selection is started

Setting the drag.smoothed to false ensures that the target will be moved straight to the current mouse position
  • Loading branch information
waaake committed Jan 15, 2025
1 parent 3e8b736 commit cdad661
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions meshroom/ui/qml/Controls/SelectionBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@ Item {
property alias border: selectionBox.border

readonly property bool active: mouseArea.drag.target == dragTarget
readonly property int isDragSmoothed: mouseArea.drag.smoothed

signal selectionEnded(rect selectionRect, int modifiers)

function startSelection(mouse) {
dragTarget.startPos.x = dragTarget.x = mouse.x;
dragTarget.startPos.y = dragTarget.y = mouse.y;
dragTarget.modifiers = mouse.modifiers;
mouseArea.drag.smoothed = false;
mouseArea.drag.target = dragTarget;
}

function endSelection() {
if (!active) {
return;
}
mouseArea.drag.smoothed = isDragSmoothed;
mouseArea.drag.target = null;
const rect = Qt.rect(selectionBox.x, selectionBox.y, selectionBox.width, selectionBox.height)
selectionEnded(rect, dragTarget.modifiers);
Expand Down

0 comments on commit cdad661

Please sign in to comment.