on xenial help sign in
Changes for HUD 2.0, behaviour...
commite858a5ae0a34ffaaf0d48fc974e25cf5396e969f authorAndrea Cimitan <andrea.cimitan@canonical.com> dateFri 13 Sep 2013, 12:40 (13 years ago) parent7c94ed8
1 file changed+24−4
Bottombar/Bottombar.qml+24−4
Bottombar/Bottombar.qml+24−4
@@ -107,20 +107,22 @@ Item {
107107 height: distanceThreshold
108108 anchors.bottom: parent.bottom
109109
110− distanceThreshold: units.gu(1)
110+ distanceThreshold: units.gu(8)
111111 enabled: !theHud.shown && bottombar.enabled && applicationIsOnForeground
112112 direction: Direction.Upwards
113113
114114 property int previousStatus: -1
115115 property real touchStartX: -1
116116
117+ readonly property real distanceFromThreshold: Math.max((-distance) - distanceThreshold, 0) // distance is negative
118+ readonly property real commitDistance: units.gu(6)
119+ readonly property real commitProgress: Math.min((distanceFromThreshold - commitDistance) / commitDistance, 1)
120+
117121 onStatusChanged: {
118122 if (status === DirectionalDragArea.WaitingForTouch) {
119123 if (previousStatus == DirectionalDragArea.Recognized) {
120124 if (hudButton.mouseOver) {
121125 hudButton.clicked()
122− } else {
123− bottombar.state = "hidden"
124126 }
125127 }
126128 } else if (status === DirectionalDragArea.Undecided) {
@@ -128,10 +130,17 @@ Item {
128130 touchStartX = touchX
129131 }
130132 } else if (status === DirectionalDragArea.Recognized) {
131− bottombar.state = "shown"
133+ bottombar.state = "hint"
132134 }
133135 previousStatus = status
134136 }
137+
138+ onDistanceChanged: {
139+ if (status === DirectionalDragArea.Recognized) {
140+ if (distanceFromThreshold > commitDistance)
141+ bottombar.state = "shown"
142+ }
143+ }
135144 }
136145
137146 MouseArea {
@@ -153,6 +162,17 @@ Item {
153162 PropertyChanges { target: hudButton; opacity: 0}
154163 PropertyChanges { target: hudButton; bottomMargin: units.gu(-1)}
155164 },
165+ State {
166+ name: "hint"
167+ PropertyChanges {
168+ target: hudButton;
169+ opacity: 0.5 + 0.5 * dragArea.commitProgress
170+ }
171+ PropertyChanges {
172+ target: hudButton;
173+ bottomMargin: units.gu(-1) + units.gu(1) * dragArea.commitProgress
174+ }
175+ },
156176 State {
157177 name: "shown"
158178 PropertyChanges { target: hudButton; opacity: 1}