@@ -57,17 +57,7 @@ Showable {
58 height: minimizedPanelHeight
58 height: minimizedPanelHeight
60− onUnitProgressChanged: {
60+ onUnitProgressChanged: d.updateState()
61− if (!showAnimation.running && !hideAnimation.running) {
62− if (unitProgress <= 0) {
63− root.state = "initial";
64− } else if (unitProgress >= 0.9 && d.hasCommitted) {
65− root.state = "locked";
67− root.state = "reveal";
71 clip: root.partiallyOpened
61 clip: root.partiallyOpened
@@ -196,12 +186,21 @@ Showable {
196 stretch: true
186 stretch: true
197 maxTotalDragDistance: openedHeight - expandedPanelHeight - handle.height
187 maxTotalDragDistance: openedHeight - expandedPanelHeight - handle.height
198 distanceThreshold: 0
188 distanceThreshold: 0
190+ onTouchSceneXChanged: {
191+ if (root.state === "locked") {
192+ d.xDisplacementSinceLock += (touchSceneX - d.lastHideTouchSceneX)
193+ d.lastHideTouchSceneX = touchSceneX;
201 PanelVelocityCalculator {
198 PanelVelocityCalculator {
202 id: yVelocityCalculator
199 id: yVelocityCalculator
203− velocityThreshold: 0.5
200+ velocityThreshold: d.hasCommitted ? 0.1 : 0.3
204 trackedValue: d.activeDragHandle ? d.activeDragHandle.touchSceneY : 0
201 trackedValue: d.activeDragHandle ? d.activeDragHandle.touchSceneY : 0
203+ onVelocityAboveThresholdChanged: d.updateState()
207 Connections {
206 Connections {
@@ -226,11 +225,27 @@ Showable {
227 property var activeDragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle.dragging ? hideDragHandle : null
226 property var activeDragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle.dragging ? hideDragHandle : null
228 property bool hasCommitted: false
227 property bool hasCommitted: false
228+ property real lastHideTouchSceneX: 0
229+ property real xDisplacementSinceLock: 0
230+ onXDisplacementSinceLockChanged: d.updateState()
230 property real rowMappedLateralPosition: {
232 property real rowMappedLateralPosition: {
231 if (!d.activeDragHandle) return -1;
233 if (!d.activeDragHandle) return -1;
232 return d.activeDragHandle.mapToItem(bar, d.activeDragHandle.touchX, 0).x;
234 return d.activeDragHandle.mapToItem(bar, d.activeDragHandle.touchX, 0).x;
237+ function updateState() {
238+ if (!showAnimation.running && !hideAnimation.running) {
239+ if (unitProgress <= 0) {
240+ root.state = "initial";
241+ // lock indicator if we've been committed and aren't moving too much laterally or too fast up.
242+ } else if (d.hasCommitted && (Math.abs(d.xDisplacementSinceLock) < units.gu(1) || yVelocityCalculator.velocityAboveThreshold)) {
243+ root.state = "locked";
245+ root.state = "reveal";
236 states: [
251 states: [
@@ -244,7 +259,8 @@ Showable {
244 script: {
259 script: {
245 yVelocityCalculator.reset();
260 yVelocityCalculator.reset();
246 // initial item selection
261 // initial item selection
247− bar.selectItemAt(d.activeDragHandle ? d.activeDragHandle.touchX : -1);
262+ if (!d.hasCommitted) bar.selectItemAt(d.activeDragHandle ? d.activeDragHandle.touchX : -1);
263+ d.hasCommitted = false;
250 PropertyChanges {
266 PropertyChanges {
@@ -274,17 +290,28 @@ Showable {
274 return mapped.x;
290 return mapped.x;
277− PropertyChanges { target: d; hasCommitted: false; restoreEntryValues: false }
280 name: "locked"
295 name: "locked"
298+ d.xDisplacementSinceLock = 0;
299+ d.lastHideTouchSceneX = hideDragHandle.touchSceneX;
281 PropertyChanges { target: bar; expanded: true }
302 PropertyChanges { target: bar; expanded: true }
284 name: "commit"
305 name: "commit"
285 extend: "locked"
306 extend: "locked"
286 PropertyChanges { target: bar; interactive: true }
307 PropertyChanges { target: bar; interactive: true }
311+ lastHideTouchSceneX: 0
312+ xDisplacementSinceLock: 0
287− PropertyChanges { target: d; hasCommitted: true; restoreEntryValues: false }
313+ restoreEntryValues: false
290 state: "initial"
317 state: "initial"