on xenial help sign in
Added re-drag for indicator selection when already opened
61b5de0Nick Dedekind
Panel/Indicators.qml+40−8
@@ -35,6 +35,7 @@ Showable {
35 property bool partiallyOpened: height > panelHeight && !fullyOpened
35 property bool partiallyOpened: height > panelHeight && !fullyOpened
36 property real visualBottom: Math.max(y+height, y+indicatorRow.y+indicatorRow.height)
36 property real visualBottom: Math.max(y+height, y+indicatorRow.y+indicatorRow.height)
37 property bool contentEnabled: true
37 property bool contentEnabled: true
38+ property bool initalizeItem: true
38
39
39 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
40 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
40 // use its own values. Need to ask design about this.
41 // use its own values. Need to ask design about this.
@@ -60,14 +61,13 @@ Showable {
60 }
61 }
61
62
62 height: panelHeight
63 height: panelHeight
64+ onHeightChanged: updateRevealProgressState(indicators.height - panelHeight, true)
63
65
64− onHeightChanged: {
66+ function updateRevealProgressState(revealProgress, enableRelease) {
65− // need to use handle.get_height(). As the handle height depends on indicators.height changes (but this is called first!)
66− var revealProgress = indicators.height - panelHeight
67 if (!showAnimation.running && !hideAnimation.running) {
67 if (!showAnimation.running && !hideAnimation.running) {
68− if (revealProgress == 0) {
68+ if (revealProgress === 0) {
69 indicators.state = "initial";
69 indicators.state = "initial";
70− } else if (revealProgress <= hintValue) {
70+ } else if (revealProgress > 0 && revealProgress <= hintValue) {
71 indicators.state = "hint";
71 indicators.state = "hint";
72 } else if (revealProgress > hintValue && revealProgress < lockThreshold) {
72 } else if (revealProgress > hintValue && revealProgress < lockThreshold) {
73 indicators.state = "reveal";
73 indicators.state = "reveal";
@@ -76,7 +76,7 @@ Showable {
76 }
76 }
77 }
77 }
78
78
79− if (revealProgress == 0) {
79+ if (enableRelease && revealProgress === 0) {
80 menuContent.releaseContent();
80 menuContent.releaseContent();
81 }
81 }
82 }
82 }
@@ -103,7 +103,7 @@ Showable {
103 Vertical velocity check. Don't change the indicator if we're moving too quickly.
103 Vertical velocity check. Don't change the indicator if we're moving too quickly.
104 */
104 */
105 var verticalSpeed = Math.abs(yVelocityCalculator.calculate());
105 var verticalSpeed = Math.abs(yVelocityCalculator.calculate());
106− if (verticalSpeed >= 0.05 && indicatorRow.currentItem!=null) {
106+ if (verticalSpeed >= 0.05 && !initalizeItem) {
107 return;
107 return;
108 }
108 }
109
109
@@ -143,6 +143,7 @@ Showable {
143 } else if (!currentItem) {
143 } else if (!currentItem) {
144 indicatorRow.setDefaultItem();
144 indicatorRow.setDefaultItem();
145 }
145 }
146+ initalizeItem = indicatorRow.currentItem == null;
146 }
147 }
147
148
148 // eater
149 // eater
@@ -276,6 +277,37 @@ Showable {
276 enableIndexChangeSignal = oldActive;
277 enableIndexChangeSignal = oldActive;
277 }
278 }
278 }
279 }
280+
281+ EdgeDragArea {
282+ id: rowDragArea
283+ anchors.fill: parent
284+ direction: Direction.Downwards
285+ maxSilenceTime: 2000
286+
287+ enabled: fullyOpened
288+ onDraggingChanged: {
289+ if (dragging) {
290+ initalizeItem = true;
291+ updateRevealProgressState(Math.max(touchSceneY - panelHeight, hintValue), false);
292+ } else {
293+ indicators.state = "commit";
294+ }
295+ }
296+
297+ onTouchXChanged: {
298+ if (touchSceneY - panelHeight > 0) {
299+ indicators.calculateCurrentItem(touchX, true);
300+ }
301+ }
302+ onTouchSceneYChanged: {
303+ updateRevealProgressState(Math.max(touchSceneY - panelHeight, hintValue), false);
304+ yVelocityCalculator.trackedPosition = touchSceneY;
305+
306+ if (initalizeItem && touchSceneY - panelHeight > 0) {
307+ indicators.calculateCurrentItem(touchX, true);
308+ }
309+ }
310+ }
279 }
311 }
280
312
281 Connections {
313 Connections {
@@ -292,7 +324,7 @@ Showable {
292 onRunningChanged: {
324 onRunningChanged: {
293 if (hideAnimation.running) {
325 if (hideAnimation.running) {
294 indicators.state = "initial";
326 indicators.state = "initial";
295− indicatorRow.currentItem = null;
327+ initalizeItem = true;
296 }
328 }
297 }
329 }
298 }
330 }