ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #00745
[Merge] lp:~flscogna/ubuntu-terminal-app/fix-1431558 into lp:ubuntu-terminal-app
Filippo Scognamiglio has proposed merging lp:~flscogna/ubuntu-terminal-app/fix-1431558 into lp:ubuntu-terminal-app.
Commit message:
Fix inconsistent scrolling behaviour.
Requested reviews:
Ubuntu Terminal Developers (ubuntu-terminal-dev)
Related bugs:
Bug #1431558 in Ubuntu Terminal App: "Scrolling console content may become very slow"
https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1431558
For more details, see:
https://code.launchpad.net/~flscogna/ubuntu-terminal-app/fix-1431558/+merge/253011
Fix inconsistent scrolling behaviour.
--
Your team Ubuntu Terminal Developers is requested to review the proposed merge of lp:~flscogna/ubuntu-terminal-app/fix-1431558 into lp:ubuntu-terminal-app.
=== modified file 'src/app/qml/TerminalInputArea.qml'
--- src/app/qml/TerminalInputArea.qml 2015-02-20 13:03:59 +0000
+++ src/app/qml/TerminalInputArea.qml 2015-03-16 01:33:38 +0000
@@ -16,12 +16,11 @@
signal touchClick(int x, int y);
signal touchPress(int x, int y);
signal touchRelease(int x, int y);
- signal swipeUpDetected();
- signal swipeDownDetected();
- signal swipeLeftDetected();
- signal swipeRightDetected();
- signal twoFingerSwipeUp();
- signal twoFingerSwipeDown();
+
+ signal swipeYDetected(int steps);
+ signal swipeXDetected(int steps);
+ signal twoFingerSwipeYDetected(int steps);
+ signal twoFingerSwipeXDetected(int steps);
// Semantic signals
signal alternateAction(int x, int y);
@@ -87,25 +86,22 @@
var dragSteps = dragValue / swipeDelta;
var dragStepsX = dragValueX / swipeDelta;
+ var dragStepsFloorY = absFloor(dragSteps);
+ var dragStepsFloorX = absFloor(dragStepsX);
+
if (!__moved && distance(touchPoints[0], __pressPosition) > swipeDelta)
__moved = true;
- if (__dragging !== xDragging && absFloor(dragSteps) < absFloor(__prevDragStepsY)) {
- swipeUpDetected();
- __dragging = yDragging;
- } else if (__dragging !== xDragging && absFloor(dragSteps) > absFloor(__prevDragStepsY)) {
- swipeDownDetected();
- __dragging = yDragging;
- } else if (__dragging !== yDragging && absFloor(dragStepsX) < absFloor(__prevDragStepsX)) {
- swipeLeftDetected();
- __dragging = xDragging;
- } else if (__dragging !== yDragging && absFloor(dragStepsX) > absFloor(__prevDragStepsX)) {
- swipeRightDetected();
+ if (__dragging !== xDragging && dragStepsFloorY !== __prevDragStepsY) {
+ swipeYDetected(dragStepsFloorY - __prevDragStepsY);
+ __dragging = yDragging;
+ } else if (__dragging !== yDragging && dragStepsFloorX !== __prevDragStepsX) {
+ swipeXDetected(dragStepsFloorX - __prevDragStepsX);
__dragging = xDragging;
}
- __prevDragStepsY = dragSteps;
- __prevDragStepsX = dragStepsX;
+ __prevDragStepsY = dragStepsFloorY;
+ __prevDragStepsX = dragStepsFloorX;
}
onReleased: {
var timerRunning = pressAndHoldTimer.running;
@@ -142,13 +138,13 @@
var dragValue = touchPoint.y - __pressPosition.y;
var dragSteps = dragValue / swipeDelta;
- if (absFloor(dragSteps) < absFloor(__prevDragSteps)) {
- twoFingerSwipeUp();
- } else if (absFloor(dragSteps) > absFloor(__prevDragSteps)) {
- twoFingerSwipeDown();
+ var dragStepsFloorY = absFloor(dragSteps);
+
+ if (dragStepsFloorY !== __prevDragSteps) {
+ twoFingerSwipeYDetected(dragStepsFloorY - __prevDragSteps);
}
- __prevDragSteps = dragSteps;
+ __prevDragSteps = dragStepsFloorY;
}
mouseEnabled: false
=== modified file 'src/app/qml/TerminalPage.qml'
--- src/app/qml/TerminalPage.qml 2015-02-20 13:03:59 +0000
+++ src/app/qml/TerminalPage.qml 2015-03-16 01:33:38 +0000
@@ -55,15 +55,68 @@
onMouseWheelDetected: terminal.simulateWheel(x, y, buttons, modifiers, angleDelta);
// Touch actions
- onSwipeUpDetected: terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, -wheelValue));
- onSwipeDownDetected: terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, wheelValue));
onTouchClick: terminal.simulateKeyPress(Qt.Key_Tab, Qt.NoModifier, true, 0, "");
- onTwoFingerSwipeUp: terminal.simulateKeyPress(Qt.Key_Up, Qt.NoModifier, true, 0, "");
- onTwoFingerSwipeDown: terminal.simulateKeyPress(Qt.Key_Down, Qt.NoModifier, true, 0, "");
onTouchPressAndHold: alternateAction(x, y);
- onSwipeLeftDetected: terminal.simulateKeyPress(Qt.Key_Left, Qt.NoModifier, true, 0, "");
- onSwipeRightDetected: terminal.simulateKeyPress(Qt.Key_Right, Qt.NoModifier, true, 0, "");
+ // Swipe actions
+ onSwipeYDetected: {
+ if (steps > 0) {
+ simulateSwipeDown(steps);
+ } else {
+ simulateSwipeUp(-steps);
+ }
+ }
+ onSwipeXDetected: {
+ if (steps > 0) {
+ simulateSwipeRight(steps);
+ } else {
+ simulateSwipeLeft(-steps);
+ }
+ }
+ onTwoFingerSwipeYDetected: {
+ if (steps > 0) {
+ simulateDualSwipeDown(steps);
+ } else {
+ simulateDualSwipeUp(-steps);
+ }
+ }
+
+ function simulateSwipeUp(steps) {
+ while(steps > 0) {
+ terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, -wheelValue));
+ steps--;
+ }
+ }
+ function simulateSwipeDown(steps) {
+ while(steps > 0) {
+ terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, wheelValue));
+ steps--;
+ }
+ }
+ function simulateSwipeLeft(steps) {
+ while(steps > 0) {
+ terminal.simulateKeyPress(Qt.Key_Left, Qt.NoModifier, true, 0, "");
+ steps--;
+ }
+ }
+ function simulateSwipeRight(steps) {
+ while(steps > 0) {
+ terminal.simulateKeyPress(Qt.Key_Right, Qt.NoModifier, true, 0, "");
+ steps--;
+ }
+ }
+ function simulateDualSwipeUp(steps) {
+ while(steps > 0) {
+ terminal.simulateKeyPress(Qt.Key_Up, Qt.NoModifier, true, 0, "");
+ steps--;
+ }
+ }
+ function simulateDualSwipeDown(steps) {
+ while(steps > 0) {
+ terminal.simulateKeyPress(Qt.Key_Down, Qt.NoModifier, true, 0, "");
+ steps--;
+ }
+ }
// Semantic actions
onAlternateAction: {
Follow ups