@@ -496,12 +496,33 @@ FocusScope {
497 function easeInOutCubic(t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 }
497 function easeInOutCubic(t) { return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1 }
499+ property var lastDragPoints: []
501+ function dragDirection() {
502+ if (lastDragPoints.length < 5) {
508+ for (var i = lastDragPoints.length - 5; i < lastDragPoints.length; i++) {
509+ if (toRight && lastDragPoints[i] < lastDragPoints[i-1]) {
512+ if (toLeft && lastDragPoints[i] > lastDragPoints[i-1]) {
516+ return toRight ? "right" : toLeft ? "left" : "unknown";
499 onDistanceChanged: {
519 onDistanceChanged: {
500 if (dragging && launcher.state != "visible" && launcher.state != "drawer") {
520 if (dragging && launcher.state != "visible" && launcher.state != "drawer") {
501 panel.x = -panel.width + Math.min(Math.max(0, distance), panel.width);
521 panel.x = -panel.width + Math.min(Math.max(0, distance), panel.width);
504 if (root.drawerEnabled && dragging && launcher.state != "drawer") {
524 if (root.drawerEnabled && dragging && launcher.state != "drawer") {
525+ lastDragPoints.push(distance)
505 var drawerHintDistance = panel.width + units.gu(1)
526 var drawerHintDistance = panel.width + units.gu(1)
506 if (distance < drawerHintDistance) {
527 if (distance < drawerHintDistance) {
507 drawer.anchors.rightMargin = -Math.min(Math.max(0, distance), drawer.width);
528 drawer.anchors.rightMargin = -Math.min(Math.max(0, distance), drawer.width);
@@ -517,17 +538,18 @@ FocusScope {
517 onDraggingChanged: {
538 onDraggingChanged: {
518 if (!dragging) {
539 if (!dragging) {
519 if (distance > panel.width / 2) {
540 if (distance > panel.width / 2) {
520− if (root.drawerEnabled && distance > panel.width * 3) {
541+ if (root.drawerEnabled && distance > panel.width * 3 && dragDirection() !== "left") {
521− root.switchToNextState("drawer")
542+ root.switchToNextState("drawer");
522 root.focus = true;
543 root.focus = true;
524− root.switchToNextState("visible")
545+ root.switchToNextState("visible");
526 } else if (root.state === "") {
547 } else if (root.state === "") {
527 // didn't drag far enough. rollback
548 // didn't drag far enough. rollback
528− root.switchToNextState("")
549+ root.switchToNextState("");
552+ lastDragPoints = [];