on xenial help sign in
Indicator re-select by dragging from top when fully opened. Fixes: https://bugs.launchpad.net/bugs/1213164.

Approved by Michał Sawicz, PS Jenkins bot.

commitf557b4e16ff02638dc5dbf588fc4ae6bf90b153d authorNick Dedekind <nicholas.dedekind@gmail.com> dateMon 18 Nov 2013, 18:05 (13 years ago) parent95427dfc21f08c
2 files changed+49−12
Panel/Indicators.qml+36−8 tests/qmltests/Panel/tst_Panel.qml+13−4
Panel/Indicators.qml+36−8
@@ -37,6 +37,7 @@ Showable {
3737 property bool partiallyOpened: height > panelHeight && !fullyOpened
3838 property real visualBottom: Math.max(y+height, y+indicatorRow.y+indicatorRow.height)
3939 property bool contentEnabled: true
40+ property bool initalizeItem: true
4041 readonly property alias content: menuContent
4142
4243 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
@@ -63,14 +64,13 @@ Showable {
6364 }
6465
6566 height: panelHeight
67+ onHeightChanged: updateRevealProgressState(indicators.height - panelHeight, true)
6668
67− onHeightChanged: {
68− // need to use handle.get_height(). As the handle height depends on indicators.height changes (but this is called first!)
69− var revealProgress = indicators.height - panelHeight
69+ function updateRevealProgressState(revealProgress, enableRelease) {
7070 if (!showAnimation.running && !hideAnimation.running) {
71− if (revealProgress == 0) {
71+ if (revealProgress === 0) {
7272 indicators.state = "initial";
73− } else if (revealProgress <= hintValue) {
73+ } else if (revealProgress > 0 && revealProgress <= hintValue) {
7474 indicators.state = "hint";
7575 } else if (revealProgress > hintValue && revealProgress < lockThreshold) {
7676 indicators.state = "reveal";
@@ -79,7 +79,7 @@ Showable {
7979 }
8080 }
8181
82− if (revealProgress == 0) {
82+ if (enableRelease && revealProgress === 0) {
8383 menuContent.releaseContent();
8484 }
8585 }
@@ -106,7 +106,7 @@ Showable {
106106 Vertical velocity check. Don't change the indicator if we're moving too quickly.
107107 */
108108 var verticalSpeed = Math.abs(yVelocityCalculator.calculate());
109− if (verticalSpeed >= 0.05 && indicatorRow.currentItem!=null) {
109+ if (verticalSpeed >= 0.05 && !initalizeItem) {
110110 return;
111111 }
112112
@@ -146,6 +146,7 @@ Showable {
146146 } else if (!currentItem) {
147147 indicatorRow.setDefaultItem();
148148 }
149+ initalizeItem = indicatorRow.currentItem == null;
149150 }
150151
151152 // eater
@@ -281,6 +282,33 @@ Showable {
281282 enableIndexChangeSignal = oldActive;
282283 }
283284 }
285+
286+ EdgeDragArea {
287+ id: rowDragArea
288+ anchors.fill: indicatorRow
289+ direction: Direction.Downwards
290+ maxSilenceTime: 2000
291+ distanceThreshold: 0
292+
293+ enabled: fullyOpened
294+ onDraggingChanged: {
295+ if (dragging) {
296+ initalizeItem = true;
297+ updateRevealProgressState(Math.max(touchSceneY - panelHeight, hintValue), false);
298+ indicators.calculateCurrentItem(touchX, false);
299+ } else {
300+ indicators.state = "commit";
301+ }
302+ }
303+
304+ onTouchXChanged: {
305+ indicators.calculateCurrentItem(touchX, true);
306+ }
307+ onTouchSceneYChanged: {
308+ updateRevealProgressState(Math.max(touchSceneY - panelHeight, hintValue), false);
309+ yVelocityCalculator.trackedPosition = touchSceneY;
310+ }
311+ }
284312 }
285313
286314 Connections {
@@ -297,7 +325,7 @@ Showable {
297325 onRunningChanged: {
298326 if (hideAnimation.running) {
299327 indicators.state = "initial";
300− indicatorRow.currentItem = null;
328+ initalizeItem = true;
301329 }
302330 }
303331 }
tests/qmltests/Panel/tst_Panel.qml+13−4
@@ -48,9 +48,12 @@ Item {
4848
4949 function get_window_data() {
5050 return [
51− {tag: "pinned", fullscreenFlag: false },
52− {tag: "fullscreen", fullscreenFlag: true }
53− ]}
51+ {tag: "pinned", fullscreenFlag: false, alreadyOpen: false },
52+ {tag: "fullscreen", fullscreenFlag: true, alreadyOpen: false },
53+ {tag: "pinned-alreadyOpen", fullscreenFlag: false, alreadyOpen: true },
54+ {tag: "fullscreen-alreadyOpen", fullscreenFlag: true, alreadyOpen: true }
55+ ];
56+ }
5457
5558 function init() {
5659 searchClicked = false;
@@ -134,6 +137,10 @@ Item {
134137 // expose more of the panel, binding it to the selected indicator and opening it's menu.
135138 function test_drag_show(data) {
136139 panel.fullscreenMode = data.fullscreenFlag;
140+ if (data.alreadyOpen) {
141+ panel.indicators.show();
142+ tryCompare(panel.indicators, "fullyOpened", true);
143+ }
137144
138145 var indicatorRow = findChild(panel.indicators, "indicatorRow");
139146 verify(indicatorRow != undefined);
@@ -185,7 +192,9 @@ Item {
185192 compare(menuContent.currentMenuIndex, i, "Menu conetent should be enabled for item at position " + i);
186193
187194 // init for next indicatorItem
188− init();
195+ if (!data.alreadyOpen) {
196+ init();
197+ }
189198 }
190199 }
191200