diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2019-11-18 16:32:25 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2019-11-23 15:41:18 +0100 |
commit | fad8ef3e4133538e3785d7067c35c652bc894711 (patch) | |
tree | ca0d85658bbe52faf5460725e7698b58032b9461 /src/imports | |
parent | acb6ed0815f92588c3ff875a568e9561fe61218c (diff) |
mouseDrag(): ensure that intermediate moves are done for all drags
The code checking if the intermediate move distance was less than
the drag threshold, but without accounting for negative distances.
Since the negative distances were naturally less than the drag
threshold, the intermediate distances were set to zero and the
intermediate moves were never done.
In practice, this means that mouseDrag() never did intermediate
moves (i.e. what happens during a drag in real life) for drags
that go from right to left or upwards.
Task-number: QTBUG-80152
Change-Id: Ic27021f5ce5ba2937e95fb2dfb532bd2136f4205
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/testlib/TestCase.qml | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index fff375b49a..20c5ce6418 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -1417,12 +1417,12 @@ Item { // Divide dx and dy to have intermediate mouseMove while dragging // Fractions of dx/dy need be superior to the dragThreshold // to make the drag works though - var ddx = Math.round(dx/3) - if (ddx < (util.dragThreshold + 1)) - ddx = 0 - var ddy = Math.round(dy/3) - if (ddy < (util.dragThreshold + 1)) - ddy = 0 + var intermediateDx = Math.round(dx/3) + if (Math.abs(intermediateDx) < (util.dragThreshold + 1)) + intermediateDx = 0 + var intermediateDy = Math.round(dy/3) + if (Math.abs(intermediateDy) < (util.dragThreshold + 1)) + intermediateDy = 0 mousePress(item, x, y, button, modifiers, delay) @@ -1431,9 +1431,9 @@ Item { var dragTriggerXDistance = dx > 0 ? (util.dragThreshold + 1) : 0 var dragTriggerYDistance = dy > 0 ? (util.dragThreshold + 1) : 0 mouseMove(item, x + dragTriggerXDistance, y + dragTriggerYDistance, moveDelay, button) - if (ddx > 0 || ddy > 0) { - mouseMove(item, x + ddx, y + ddy, moveDelay, button) - mouseMove(item, x + 2*ddx, y + 2*ddy, moveDelay, button) + if (intermediateDx !== 0 || intermediateDy !== 0) { + mouseMove(item, x + intermediateDx, y + intermediateDy, moveDelay, button) + mouseMove(item, x + 2*intermediateDx, y + 2*intermediateDy, moveDelay, button) } mouseMove(item, x + dx, y + dy, moveDelay, button) mouseRelease(item, x + dx, y + dy, button, modifiers, delay) |