~paulliu/unity8/lp1350891_ScrollBackground

« back to all changes in this revision

Viewing changes to qml/Components/EdgeDragEvaluator.qml

  • Committer: Ying-Chun Liu
  • Date: 2015-02-13 13:27:19 UTC
  • mfrom: (1431.1.180 unity8)
  • Revision ID: paul.liu@canonical.com-20150213132719-8itxhrauv317p18p
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
    // Returns whether the drag should continue by itself until completed.
54
54
    function shouldAutoComplete() {
55
55
        var deltaPos = trackedPosition - __startPosition;
 
56
 
56
57
        if (Math.abs(deltaPos) < minDragDistance) {
57
58
            velocity = 0;
58
59
            minVelocity = 0;
59
60
            return false;
60
61
        }
61
62
 
62
 
        minVelocity = __calculateMinimumVelocityForAutoCompletion(deltaPos);
63
63
        velocity = calculate();
64
64
 
65
 
        if (Direction.isPositive(direction) && (velocity >= minVelocity)
66
 
            || !Direction.isPositive(direction) && (velocity <= minVelocity)) {
67
 
            return true;
 
65
        if (direction == Direction.Horizontal) {
 
66
            minVelocity = __calculateMinimumVelocityForAutoCompletion(Math.abs(deltaPos));
 
67
            return Math.abs(velocity) >= minVelocity;
68
68
        } else {
69
 
            return false;
 
69
            minVelocity = __calculateMinimumVelocityForAutoCompletion(deltaPos);
 
70
            if (Direction.isPositive(direction) && (velocity >= minVelocity)
 
71
                   || !Direction.isPositive(direction) && (velocity <= minVelocity)) {
 
72
                return true;
 
73
            } else {
 
74
                return false;
 
75
            }
70
76
        }
71
77
    }
72
78