@@ -19,9 +19,6 @@ import QtQuick 2.0
20 id: scrollArea
20 id: scrollArea
22− property real __previousMouseX: -1
23− property real __progression: 0
24− property real __previousMouseXHelper: -1
25 property real thresholdAreaWidth: units.gu(1)
22 property real thresholdAreaWidth: units.gu(1)
26 property bool showDebugRectangles: false
23 property bool showDebugRectangles: false
27 property int direction: Qt.LeftToRight
24 property int direction: Qt.LeftToRight
@@ -47,33 +44,29 @@ Item {
47 rotation: direction == Qt.LeftToRight ? 0 : 180
44 rotation: direction == Qt.LeftToRight ? 0 : 180
49 function handleEnter() {
46 function handleEnter() {
50− thresholdRect.x = -scrollArea.thresholdAreaWidth
47+ d.threasholdAreaX = -scrollArea.thresholdAreaWidth
51 scrollTimer.restart()
48 scrollTimer.restart()
53 onLateralPositionChanged: {
50 onLateralPositionChanged: {
54 if (scrollArea.areaActive) {
51 if (scrollArea.areaActive) {
56− // store the previous x value
57− __previousMouseX = __previousMouseXHelper
58− __previousMouseXHelper = lateralPosition
60 if (lateralPosition > width * (1 - forceScrollingPercentage)) {
53 if (lateralPosition > width * (1 - forceScrollingPercentage)) {
61− thresholdRect.x = width * (1 - forceScrollingPercentage)
54+ d.threasholdAreaX = width * (1 - forceScrollingPercentage)
62 if (!scrollTimer.running) scrollTimer.restart()
55 if (!scrollTimer.running) scrollTimer.restart()
63− } else if (lateralPosition > thresholdRect.x + thresholdRect.width) {
56+ } else if (lateralPosition > d.threasholdAreaX + scrollArea.thresholdAreaWidth) {
64− thresholdRect.x = lateralPosition - thresholdRect.width
57+ d.threasholdAreaX = lateralPosition - scrollArea.thresholdAreaWidth
65 if (!scrollTimer.running) scrollTimer.restart()
58 if (!scrollTimer.running) scrollTimer.restart()
66− } else if (lateralPosition < thresholdRect.x) {
59+ } else if (lateralPosition < d.threasholdAreaX) {
67− thresholdRect.x = lateralPosition
60+ d.threasholdAreaX = lateralPosition
68 scrollTimer.stop()
61 scrollTimer.stop()
71− __progression = lateralPosition / width
64+ d.progression = lateralPosition / width
75 function handleExit() {
68 function handleExit() {
76− thresholdRect.x = -scrollArea.thresholdAreaWidth
69+ d.threasholdAreaX = -scrollArea.thresholdAreaWidth
77 scrollTimer.stop()
70 scrollTimer.stop()
@@ -81,31 +74,13 @@ Item {
81 id: scrollTimer
74 id: scrollTimer
82 interval: 5
75 interval: 5
83 repeat: true
76 repeat: true
84− onTriggered: scrollArea.scroll(scrollArea.baseScrollAmount + scrollArea.maximumScrollAmount*scrollArea.__progression)
77+ onTriggered: scrollArea.scroll(scrollArea.baseScrollAmount + scrollArea.maximumScrollAmount * d.progression)
90− anchors.fill: scrollArea
91− visible: showDebugRectangles
94− Rectangle {
80+ QtObject {
95− color: "red"
81+ id: d
97− height: scrollArea.height
98− width: scrollArea.width * forceScrollingPercentage
99− anchors.right: parent.right
100− visible: showDebugRectangles
103− Rectangle {
83+ property real progression: 0
106− height: parent.height
107− width: scrollArea.thresholdAreaWidth
108− x: -scrollArea.thresholdAreaWidth
84+ property real threasholdAreaX: -scrollArea.thresholdAreaWidth
109− color: showDebugRectangles ? "blue" : "transparent"