on xenial help sign in
Added re-drag for indicator selection when already opened
commit61b5de0f66a3d1ae8252d5d258c5f4ba9e2051d4 authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 18 Sep 2013, 09:35 (13 years ago) parent6a74c57
1 file changed+40−8
Panel/Indicators.qml+40−8
Panel/Indicators.qml+40−8
@@ -35,6 +35,7 @@ Showable {
3535 property bool partiallyOpened: height > panelHeight && !fullyOpened
3636 property real visualBottom: Math.max(y+height, y+indicatorRow.y+indicatorRow.height)
3737 property bool contentEnabled: true
38+ property bool initalizeItem: true
3839
3940 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
4041 // use its own values. Need to ask design about this.
@@ -60,14 +61,13 @@ Showable {
6061 }
6162
6263 height: panelHeight
64+ onHeightChanged: updateRevealProgressState(indicators.height - panelHeight, true)
6365
64− onHeightChanged: {
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
66+ function updateRevealProgressState(revealProgress, enableRelease) {
6767 if (!showAnimation.running && !hideAnimation.running) {
68− if (revealProgress == 0) {
68+ if (revealProgress === 0) {
6969 indicators.state = "initial";
70− } else if (revealProgress <= hintValue) {
70+ } else if (revealProgress > 0 && revealProgress <= hintValue) {
7171 indicators.state = "hint";
7272 } else if (revealProgress > hintValue && revealProgress < lockThreshold) {
7373 indicators.state = "reveal";
@@ -76,7 +76,7 @@ Showable {
7676 }
7777 }
7878
79− if (revealProgress == 0) {
79+ if (enableRelease && revealProgress === 0) {
8080 menuContent.releaseContent();
8181 }
8282 }
@@ -103,7 +103,7 @@ Showable {
103103 Vertical velocity check. Don't change the indicator if we're moving too quickly.
104104 */
105105 var verticalSpeed = Math.abs(yVelocityCalculator.calculate());
106− if (verticalSpeed >= 0.05 && indicatorRow.currentItem!=null) {
106+ if (verticalSpeed >= 0.05 && !initalizeItem) {
107107 return;
108108 }
109109
@@ -143,6 +143,7 @@ Showable {
143143 } else if (!currentItem) {
144144 indicatorRow.setDefaultItem();
145145 }
146+ initalizeItem = indicatorRow.currentItem == null;
146147 }
147148
148149 // eater
@@ -276,6 +277,37 @@ Showable {
276277 enableIndexChangeSignal = oldActive;
277278 }
278279 }
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+ }
279311 }
280312
281313 Connections {
@@ -292,7 +324,7 @@ Showable {
292324 onRunningChanged: {
293325 if (hideAnimation.running) {
294326 indicators.state = "initial";
295− indicatorRow.currentItem = null;
327+ initalizeItem = true;
296328 }
297329 }
298330 }