on xenial help sign in
review comments
commit966e2f919b80d9969704a8352a5b4664561d0f43 authorNick Dedekind <nick.dedekind@canonical.com> dateMon 13 Oct 2014, 21:39 (12 years ago) parent76cbe21
7 files changed+15−62
qml/Components/ListItems/VerticalThinDivider.qml−26 qml/Components/ListItems/graphics/ListItemDividerVertical@18.png qml/Panel/IndicatorItemRow.qml+7−3 qml/Panel/IndicatorsBar.qml−7 qml/Panel/IndicatorsMenu.qml+2−13 qml/Panel/Panel.qml+1−5 qml/Panel/PanelVelocityCalculator.qml+5−8
qml/Components/ListItems/VerticalThinDivider.qmldeleted−26
@@ -1,26 +0,0 @@
1−/*
2− * Copyright (C) 2012 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−Image {
20− anchors {
21− top: (parent) ? parent.top : null
22− bottom: (parent) ? parent.bottom : null
23− }
24− width: (visible) ? units.dp(2) : 0
25− source: "graphics/ListItemDividerVertical.png"
26−}
qml/Components/ListItems/graphics/ListItemDividerVertical@18.pngdeleted

Binary file not shown.

qml/Panel/IndicatorItemRow.qml+7−3
@@ -35,11 +35,15 @@ Item {
3535
3636 property real lateralPosition: -1
3737 onLateralPositionChanged: {
38− if (currentItem && !enableLateralChanges) return;
39− updateItemFromLateralPosition(lateralPosition);
38+ updateItemFromLateralPosition();
39+ }
40+
41+ onEnableLateralChangesChanged: {
42+ updateItemFromLateralPosition();
4043 }
4144
42− function updateItemFromLateralPosition(lateralPosition) {
45+ function updateItemFromLateralPosition() {
46+ if (currentItem && !enableLateralChanges) return;
4347 if (lateralPosition === -1) return;
4448
4549 if (!currentItem) {
qml/Panel/IndicatorsBar.qml−7
@@ -36,13 +36,6 @@ Item {
3636 row.selectItemAt(mapped.x);
3737 }
3838
39− function updateItemFromLateralPosition(position) {
40− if (position === -1) return;
41−
42− var mapped = root.mapToItem(row, position, 0);
43− row.updateItemFromLateralPosition(mapped.x);
44− }
45−
4639 function setCurrentItemIndex(index) {
4740 if (!expanded) {
4841 row.resetCurrentItem();
qml/Panel/IndicatorsMenu.qml+2−13
@@ -200,8 +200,6 @@ Showable {
200200 id: yVelocityCalculator
201201 velocityThreshold: 0.5
202202 trackedValue: d.activeDragHandle ? d.activeDragHandle.touchSceneY : 0
203−
204− onVelocityThresholdTriggered: bar.updateItemFromLateralPosition(bar.lateralPosition);
205203 }
206204
207205 Connections {
@@ -256,7 +254,6 @@ Showable {
256254
257255 property real rowMappedLateralPosition: {
258256 if (!d.activeDragHandle) return -1;
259− if (!d.activeDragHandle.dragging) return -1;
260257 return d.activeDragHandle.mapToItem(bar, d.activeDragHandle.touchX, 0).x;
261258 }
262259 }
@@ -280,20 +277,14 @@ Showable {
280277 // changes to lateral touch position effect which indicator is selected
281278 lateralPosition: d.rowMappedLateralPosition
282279 // vertical velocity determines if changes in lateral position has an effect
283− enableLateralChanges: {
284− if (!d.activeDragHandle) return false;
285− if (!d.activeDragHandle.dragging) return false;
286−
287− return !yVelocityCalculator.stopLateralChanges;
288− }
280+ enableLateralChanges: d.activeDragHandle &&
281+ !yVelocityCalculator.velocityAboveThreshold
289282 }
290283 // left scroll bar handling
291284 PropertyChanges {
292285 target: leftScroller
293286 lateralPosition: {
294287 if (!d.activeDragHandle) return -1;
295− if (!d.activeDragHandle.dragging) return -1;
296−
297288 var mapped = d.activeDragHandle.mapToItem(leftScroller, d.activeDragHandle.touchX, 0);
298289 return mapped.x;
299290 }
@@ -303,8 +294,6 @@ Showable {
303294 target: rightScroller
304295 lateralPosition: {
305296 if (!d.activeDragHandle) return -1;
306− if (!d.activeDragHandle.dragging) return -1;
307−
308297 var mapped = d.activeDragHandle.mapToItem(rightScroller, d.activeDragHandle.touchX, 0);
309298 return mapped.x;
310299 }
qml/Panel/Panel.qml+1−5
@@ -18,7 +18,6 @@ import QtQuick 2.2
1818import Ubuntu.Components 1.1
1919import Unity.Application 0.1
2020import "../Components"
21−import "../Components/ListItems"
2221import ".."
2322
2423Item {
@@ -92,16 +91,13 @@ Item {
9291 saturation: 1 - indicators.unitProgress
9392 }
9493
95− VerticalThinDivider {
96− id: indicatorDividor
94+ Image {
9795 anchors {
9896 top: indicators.top
9997 bottom: indicators.bottom
10098 right: indicators.left
101−
10299 topMargin: indicatorArea.anchors.topMargin + indicators.minimizedPanelHeight
103100 }
104−
105101 width: units.dp(2)
106102 source: "graphics/VerticalDivider.png"
107103 }
qml/Panel/PanelVelocityCalculator.qml+5−8
@@ -20,28 +20,25 @@ import Ubuntu.Gestures 0.1
2020Item {
2121 id: root
2222 property real trackedValue: 0
23− property bool stopLateralChanges: false
23+ property bool velocityAboveThreshold: false
2424 property real velocityThreshold: 0.4
2525
26− signal velocityThresholdTriggered
27−
2826 function reset() {
2927 velocityTimer.stop();
30− stopLateralChanges = false;
28+ velocityAboveThreshold = false;
3129 calc.reset();
3230 }
3331
3432 function update() {
35− var previouslyStopped = stopLateralChanges;
33+ var previouslyStopped = velocityAboveThreshold;
3634
3735 calc.trackedPosition = trackedValue;
38− stopLateralChanges = Math.abs(calc.calculate()) > velocityThreshold;
36+ velocityAboveThreshold = Math.abs(calc.calculate()) > velocityThreshold;
3937
40− if (stopLateralChanges) { // only start timer if we're above the threshold.
38+ if (velocityAboveThreshold) { // only start timer if we're above the threshold.
4139 velocityTimer.start();
4240 } else if (previouslyStopped) { // if we have previously been stopped, then trigger the signal
4341 velocityTimer.stop();
44− velocityThresholdTriggered();
4542 }
4643 }
4744