@@ -20,8 +20,9 @@ import Ubuntu.Components 1.3
2020Item {
2121 id: scrollArea
2222
23− readonly property bool areaActive: lateralPosition >= 0
23+ readonly property bool areaActive: lateralPosition >= 0 && progressThreshold * width
2424 property real stopScrollThreshold: units.gu(2)
25+ property real progressThreshold: units.dp(4)
2526 property int direction: Qt.LeftToRight
2627 property real baseScrollAmount: units.dp(3)
2728 property real maximumScrollAmount: units.dp(8)
@@ -38,6 +39,8 @@ Item {
3839 function handleEnter() {
3940 d.thresholdAreaX = -scrollArea.stopScrollThreshold;
4041 scrollTimer.restart();
42+ d.init = true;
43+ d.passedProgressThreshold = false;
4144 }
4245
4346 function handleExit() {
@@ -59,6 +62,10 @@ Item {
5962 }
6063
6164 d.progression = lateralPosition / width;
65+ if (d.init) {
66+ d.startingProgression = d.progression;
67+ d.init = false;
68+ }
6269 }
6370 }
6471
@@ -68,14 +75,23 @@ Item {
6875 repeat: true
6976
7077 onTriggered: {
71− var scrollAmount = scrollArea.baseScrollAmount + scrollArea.maximumScrollAmount * d.progression;
72− scrollArea.scroll(scrollAmount);
78+ if (d.passedProgressThreshold ||
79+ Math.abs(d.progression - d.startingProgression) * scrollArea.width > scrollArea.progressThreshold) {
80+ d.passedProgressThreshold = true;
81+
82+ var scrollAmount = scrollArea.baseScrollAmount + scrollArea.maximumScrollAmount * d.progression;
83+ scrollArea.scroll(scrollAmount);
84+ }
7385 }
7486 }
7587
7688 QtObject {
7789 id: d
90+ property real startingProgression: 0
91+ property bool init: true
92+
7893 property real progression: 0
7994 property real thresholdAreaX: -scrollArea.stopScrollThreshold
95+ property bool passedProgressThreshold: false
8096 }
8197}