@@ -19,9 +19,6 @@ import QtQuick 2.0
1919Item {
2020 id: scrollArea
2121
22− property real __previousMouseX: -1
23− property real __progression: 0
24− property real __previousMouseXHelper: -1
2522 property real thresholdAreaWidth: units.gu(1)
2623 property bool showDebugRectangles: false
2724 property int direction: Qt.LeftToRight
@@ -47,33 +44,29 @@ Item {
4744 rotation: direction == Qt.LeftToRight ? 0 : 180
4845
4946 function handleEnter() {
50− thresholdRect.x = -scrollArea.thresholdAreaWidth
47+ d.threasholdAreaX = -scrollArea.thresholdAreaWidth
5148 scrollTimer.restart()
5249 }
5350 onLateralPositionChanged: {
5451 if (scrollArea.areaActive) {
5552
56− // store the previous x value
57− __previousMouseX = __previousMouseXHelper
58− __previousMouseXHelper = lateralPosition
59−
6053 if (lateralPosition > width * (1 - forceScrollingPercentage)) {
61− thresholdRect.x = width * (1 - forceScrollingPercentage)
54+ d.threasholdAreaX = width * (1 - forceScrollingPercentage)
6255 if (!scrollTimer.running) scrollTimer.restart()
63− } else if (lateralPosition > thresholdRect.x + thresholdRect.width) {
64− thresholdRect.x = lateralPosition - thresholdRect.width
56+ } else if (lateralPosition > d.threasholdAreaX + scrollArea.thresholdAreaWidth) {
57+ d.threasholdAreaX = lateralPosition - scrollArea.thresholdAreaWidth
6558 if (!scrollTimer.running) scrollTimer.restart()
66− } else if (lateralPosition < thresholdRect.x) {
67− thresholdRect.x = lateralPosition
59+ } else if (lateralPosition < d.threasholdAreaX) {
60+ d.threasholdAreaX = lateralPosition
6861 scrollTimer.stop()
6962 }
7063
71− __progression = lateralPosition / width
64+ d.progression = lateralPosition / width
7265 }
7366 }
7467
7568 function handleExit() {
76− thresholdRect.x = -scrollArea.thresholdAreaWidth
69+ d.threasholdAreaX = -scrollArea.thresholdAreaWidth
7770 scrollTimer.stop()
7871 }
7972
@@ -81,31 +74,13 @@ Item {
8174 id: scrollTimer
8275 interval: 5
8376 repeat: true
84− onTriggered: scrollArea.scroll(scrollArea.baseScrollAmount + scrollArea.maximumScrollAmount*scrollArea.__progression)
85− }
86−
87− Rectangle {
88− color: "yellow"
89− opacity: 0.2
90− anchors.fill: scrollArea
91− visible: showDebugRectangles
77+ onTriggered: scrollArea.scroll(scrollArea.baseScrollAmount + scrollArea.maximumScrollAmount * d.progression)
9278 }
9379
94− Rectangle {
95− color: "red"
96− opacity: 0.2
97− height: scrollArea.height
98− width: scrollArea.width * forceScrollingPercentage
99− anchors.right: parent.right
100− visible: showDebugRectangles
101− }
80+ QtObject {
81+ id: d
10282
103− Rectangle {
104− id: thresholdRect
105− opacity: 0.4
106− height: parent.height
107− width: scrollArea.thresholdAreaWidth
108− x: -scrollArea.thresholdAreaWidth
109− color: showDebugRectangles ? "blue" : "transparent"
83+ property real progression: 0
84+ property real threasholdAreaX: -scrollArea.thresholdAreaWidth
11085 }
11186}