Merge lp:~nikwen/ubuntu-terminal-app/scrolling-improvements-2 into lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot

Proposed by Niklas Wenzel
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 93
Merged at revision: 94
Proposed branch: lp:~nikwen/ubuntu-terminal-app/scrolling-improvements-2
Merge into: lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot
Diff against target: 37 lines (+10/-8)
1 file modified
src/app/qml/TerminalInputArea.qml (+10/-8)
To merge this branch: bzr merge lp:~nikwen/ubuntu-terminal-app/scrolling-improvements-2
Reviewer Review Type Date Requested Status
Filippo Scognamiglio Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+262503@code.launchpad.net

Commit message

Detect whether the swipe is a swipe in x or y direction by comparing the length of the swipe in each direction instead of simply preferring y over x swipes

Description of the change

Detect whether the swipe is a swipe in x or y direction by comparing the length of the swipe in each direction instead of simply preferring y over x swipes.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Filippo Scognamiglio (flscogna) wrote :

Thank you very much for the patch Niklas. Looks really nice to me. :)

review: Approve
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Thank you for merging it, Filippo. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/qml/TerminalInputArea.qml'
2--- src/app/qml/TerminalInputArea.qml 2015-06-14 15:42:15 +0000
3+++ src/app/qml/TerminalInputArea.qml 2015-06-19 20:56:39 +0000
4@@ -93,23 +93,25 @@
5 if (__multiTouch || multiTouchTimer.running) // Do not handle multi touch events here and detect multi touch swipes while the timer is running
6 return;
7
8- var dragValue = touchPoints[0].y - __pressPosition.y;
9+ var dragValueY = touchPoints[0].y - __pressPosition.y;
10 var dragValueX = touchPoints[0].x - __pressPosition.x;
11- var dragSteps = dragValue / swipeDelta;
12+ var dragStepsY = dragValueY / swipeDelta;
13 var dragStepsX = dragValueX / swipeDelta;
14
15- var dragStepsFloorY = absFloor(dragSteps);
16+ var dragStepsFloorY = absFloor(dragStepsY);
17 var dragStepsFloorX = absFloor(dragStepsX);
18
19- if (!__moved && distance(touchPoints[0], __pressPosition) > swipeDelta)
20+ if (!__moved && distance(touchPoints[0], __pressPosition) > swipeDelta) {
21 __moved = true;
22+ __dragging = (Math.abs(dragValueY) >= Math.abs(dragValueX)) ? yDragging : xDragging;
23+ } else if (!__moved) {
24+ return;
25+ }
26
27- if (__dragging !== xDragging && dragStepsFloorY !== __prevDragStepsY) {
28+ if (__dragging === yDragging && dragStepsFloorY !== __prevDragStepsY) {
29 swipeYDetected(dragStepsFloorY - __prevDragStepsY);
30- __dragging = yDragging;
31- } else if (__dragging !== yDragging && dragStepsFloorX !== __prevDragStepsX) {
32+ } else if (__dragging === xDragging && dragStepsFloorX !== __prevDragStepsX) {
33 swipeXDetected(dragStepsFloorX - __prevDragStepsX);
34- __dragging = xDragging;
35 }
36
37 __prevDragStepsY = dragStepsFloorY;

Subscribers

People subscribed via source and target branches