@@ -496,12 +496,33 @@ FocusScope {
496496
497497 function easeInOutCubic(t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 }
498498
499+ property var lastDragPoints: []
500+
501+ function dragDirection() {
502+ if (lastDragPoints.length < 5) {
503+ return "unknown";
504+ }
505+
506+ var toRight = true;
507+ var toLeft = true;
508+ for (var i = lastDragPoints.length - 5; i < lastDragPoints.length; i++) {
509+ if (toRight && lastDragPoints[i] < lastDragPoints[i-1]) {
510+ toRight = false;
511+ }
512+ if (toLeft && lastDragPoints[i] > lastDragPoints[i-1]) {
513+ toLeft = false;
514+ }
515+ }
516+ return toRight ? "right" : toLeft ? "left" : "unknown";
517+ }
518+
499519 onDistanceChanged: {
500520 if (dragging && launcher.state != "visible" && launcher.state != "drawer") {
501521 panel.x = -panel.width + Math.min(Math.max(0, distance), panel.width);
502522 }
503523
504524 if (root.drawerEnabled && dragging && launcher.state != "drawer") {
525+ lastDragPoints.push(distance)
505526 var drawerHintDistance = panel.width + units.gu(1)
506527 if (distance < drawerHintDistance) {
507528 drawer.anchors.rightMargin = -Math.min(Math.max(0, distance), drawer.width);
@@ -517,17 +538,18 @@ FocusScope {
517538 onDraggingChanged: {
518539 if (!dragging) {
519540 if (distance > panel.width / 2) {
520− if (root.drawerEnabled && distance > panel.width * 3) {
521− root.switchToNextState("drawer")
541+ if (root.drawerEnabled && distance > panel.width * 3 && dragDirection() !== "left") {
542+ root.switchToNextState("drawer");
522543 root.focus = true;
523544 } else {
524− root.switchToNextState("visible")
545+ root.switchToNextState("visible");
525546 }
526547 } else if (root.state === "") {
527548 // didn't drag far enough. rollback
528− root.switchToNextState("")
549+ root.switchToNextState("");
529550 }
530551 }
552+ lastDragPoints = [];
531553 }
532554 }
533555