← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~nikwen/ubuntu-terminal-app/scrolling-improvements-2 into lp:ubuntu-terminal-app

 

Niklas Wenzel has proposed merging lp:~nikwen/ubuntu-terminal-app/scrolling-improvements-2 into lp:ubuntu-terminal-app.

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

Requested reviews:
  Ubuntu Terminal Developers (ubuntu-terminal-dev)
Related bugs:
  Bug #1466988 in Ubuntu Terminal App: "Swipes in x direction are hardly recognized as such"
  https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1466988

For more details, see:
https://code.launchpad.net/~nikwen/ubuntu-terminal-app/scrolling-improvements-2/+merge/262503

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.
-- 
Your team Ubuntu Terminal Developers is requested to review the proposed merge of lp:~nikwen/ubuntu-terminal-app/scrolling-improvements-2 into lp:ubuntu-terminal-app.
=== modified file 'src/app/qml/TerminalInputArea.qml'
--- src/app/qml/TerminalInputArea.qml	2015-06-14 15:42:15 +0000
+++ src/app/qml/TerminalInputArea.qml	2015-06-19 20:56:39 +0000
@@ -93,23 +93,25 @@
             if (__multiTouch || multiTouchTimer.running) // Do not handle multi touch events here and detect multi touch swipes while the timer is running
                 return;
 
-            var dragValue = touchPoints[0].y - __pressPosition.y;
+            var dragValueY = touchPoints[0].y - __pressPosition.y;
             var dragValueX = touchPoints[0].x - __pressPosition.x;
-            var dragSteps = dragValue / swipeDelta;
+            var dragStepsY = dragValueY / swipeDelta;
             var dragStepsX = dragValueX / swipeDelta;
 
-            var dragStepsFloorY = absFloor(dragSteps);
+            var dragStepsFloorY = absFloor(dragStepsY);
             var dragStepsFloorX = absFloor(dragStepsX);
 
-            if (!__moved && distance(touchPoints[0], __pressPosition) > swipeDelta)
+            if (!__moved && distance(touchPoints[0], __pressPosition) > swipeDelta) {
                 __moved = true;
+                __dragging = (Math.abs(dragValueY) >= Math.abs(dragValueX)) ? yDragging : xDragging;
+            } else if (!__moved) {
+                return;
+            }
 
-            if (__dragging !== xDragging && dragStepsFloorY !== __prevDragStepsY) {
+            if (__dragging === yDragging && dragStepsFloorY !== __prevDragStepsY) {
                 swipeYDetected(dragStepsFloorY - __prevDragStepsY);
-                __dragging = yDragging;
-            } else if (__dragging !== yDragging && dragStepsFloorX !== __prevDragStepsX) {
+            } else if (__dragging === xDragging && dragStepsFloorX !== __prevDragStepsX) {
                 swipeXDetected(dragStepsFloorX - __prevDragStepsX);
-                __dragging = xDragging;
             }
 
             __prevDragStepsY = dragStepsFloorY;


Follow ups