on xenial help sign in
cimi review comments
commit58c8ed23760278a9709d2f92bdb4c1a0bfb08c8b authorNick Dedekind <nick.dedekind@canonical.com> dateThu 9 Oct 2014, 11:40 (12 years ago) parentd06ea16
9 files changed+66−66
qml/Components/ScrollCalculator.qml+10−17 qml/Panel/Handle.qml+3−2 qml/Panel/IndicatorItem.qml+1−1 qml/Panel/IndicatorItemRow.qml+31−28 qml/Panel/IndicatorsBar.qml+5−3 qml/Panel/IndicatorsMenu.qml+12−11 qml/Panel/MenuContent.qml+1−1 qml/Panel/Panel.qml+2−2 qml/Panel/PanelVelocityCalculator.qml+1−1
qml/Components/ScrollCalculator.qml+10−17
@@ -14,33 +14,26 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
1819
1920Item {
2021 id: scrollArea
2122
23+ readonly property bool areaActive: lateralPosition >= 0
2224 property real stopScrollThreshold: units.gu(2)
2325 property int direction: Qt.LeftToRight
24− property real baseScrollAmount: units.dp(2)
26+ property real baseScrollAmount: units.dp(2)
2527 property real maximumScrollAmount: units.dp(6)
26−
2728 property real lateralPosition: -1
28− readonly property bool areaActive: lateralPosition >= 0
29− onAreaActiveChanged: {
30− if (areaActive) {
31− handleEnter();
32− } else {
33− handleExit();
34− }
35− }
36−
37− // from 0 to 1
3829 property real forceScrollingPercentage: 0.4
30+
3931 signal scroll(real scrollAmount)
4032
41− width: 200
42− height: 200
43− rotation: direction == Qt.LeftToRight ? 0 : 180
33+ onAreaActiveChanged: areaActive ? handleEnter() : handleExit()
34+
35+ width: units.gu(5)
36+ rotation: direction === Qt.LeftToRight ? 0 : 180
4437
4538 function handleEnter() {
4639 d.threasholdAreaX = -scrollArea.stopScrollThreshold;
@@ -70,7 +63,7 @@ Item {
7063
7164 Timer {
7265 id: scrollTimer
73− interval: 5
66+ interval: 16
7467 repeat: true
7568
7669 property int iter: 0
qml/Panel/Handle.qml+3−2
@@ -14,7 +14,8 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
1819
1920Rectangle {
2021 id: handle
@@ -25,7 +26,7 @@ Rectangle {
2526 Row {
2627 id: dots
2728 width: childrenRect.width
28− height: children.height
29+ height: childrenRect.height
2930 anchors.centerIn: parent
3031 spacing: units.gu(0.5)
3132 Repeater {
qml/Panel/IndicatorItem.qml+1−1
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.1
17+import QtQuick 2.2
1818import Ubuntu.Components 1.1
1919import Ubuntu.Settings.Components 0.1
2020import "Indicators"
qml/Panel/IndicatorItemRow.qml+31−28
@@ -14,8 +14,8 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.1
18−import Ubuntu.Components 0.1
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
1919
2020Item {
2121 id: root
@@ -35,9 +35,8 @@ Item {
3535
3636 property real lateralPosition: -1
3737 onLateralPositionChanged: {
38− if (currentItem && !enableLateralChanges) return;
38+ if (currentItem || !enableLateralChanges) return;
3939 updateItemFromLateralPosition(lateralPosition);
40− highlight.updateHighlightOffset();
4140 }
4241
4342 function updateItemFromLateralPosition(lateralPosition) {
@@ -54,9 +53,10 @@ Item {
5453 var bufferExceeded = false;
5554
5655 if (proposedItem !== currentItem) {
56+ // Proposed item is not directly adjacent to current?
5757 if (Math.abs(currentItem.ownIndex - currentItem.ownIndex) > 1) {
5858 bufferExceeded = true;
59− } else {
59+ } else { // no
6060 var currentItemLateralPosition = root.mapToItem(proposedItem, lateralPosition, 0).x;
6161
6262 // Is the distance into proposed item greater than max buffer?
@@ -103,7 +103,7 @@ Item {
103103 currentItem = item;
104104 } else {
105105 // Select default item.
106− var searchIndex = lateralPosition > width ? repeater.count-1 : 0;
106+ var searchIndex = lateralPosition > width ? repeater.count - 1 : 0;
107107
108108 for (var i = 0; i < row.children.length; i++) {
109109 if (row.children[i].hasOwnProperty("ownIndex") && row.children[i].ownIndex === searchIndex) {
@@ -170,7 +170,7 @@ Item {
170170 anchors.bottom: row.bottom
171171 height: units.dp(2)
172172 color: root.hightlightColor
173− visible: root.currentItem !== null
173+ visible: currentItem !== null
174174 opacity: 0.0
175175
176176 width: currentItem ? currentItem.width : 0
@@ -181,31 +181,34 @@ Item {
181181
182182 // micromovements of the highlight line when user moves the finger across the items while pulling
183183 // the handle downwards.
184− function updateHighlightOffset() {
185− if (!currentItem || lateralPosition == -1) {
186− highlightCenterOffset = 0;
187− return;
188− }
184+ Connections {
185+ target: root
186+ onLateralPositionChanged: {
187+ if (!currentItem || lateralPosition == -1) {
188+ highlight.highlightCenterOffset = 0;
189+ return;
190+ }
191+ if (!enableLateralChanges) return;
189192
190− var itemMapped = root.mapToItem(currentItem, lateralPosition, 0);
193+ var itemMapped = root.mapToItem(currentItem, lateralPosition, 0);
191194
192− var distanceFromCenter = itemMapped.x - currentItem.width / 2;
193− if (distanceFromCenter > 0) {
194− distanceFromCenter = Math.max(0, distanceFromCenter-currentItem.width / 8);
195− } else {
196− distanceFromCenter = Math.min(0, distanceFromCenter+currentItem.width / 8);
197− }
195+ var distanceFromCenter = itemMapped.x - currentItem.width / 2;
196+ if (distanceFromCenter > 0) {
197+ distanceFromCenter = Math.max(0, distanceFromCenter - currentItem.width / 8);
198+ } else {
199+ distanceFromCenter = Math.min(0, distanceFromCenter + currentItem.width / 8);
200+ }
198201
199− if (currentItem && currentItem.ownIndex === 0 && distanceFromCenter < 0) {
200− highlightCenterOffset = 0;
201− } else if (currentItem && currentItem.ownIndex === repeater.count-1 & distanceFromCenter > 0) {
202− highlightCenterOffset = 0;
203− } else {
204− var shiftPercentageOffset = (distanceFromCenter / (currentItem.width / 4));
205− highlightCenterOffset = shiftPercentageOffset * units.gu(1);
202+ if (currentItem && currentItem.ownIndex === 0 && distanceFromCenter < 0) {
203+ highlight.highlightCenterOffset = 0;
204+ } else if (currentItem && currentItem.ownIndex === repeater.count-1 & distanceFromCenter > 0) {
205+ highlight.highlightCenterOffset = 0;
206+ } else {
207+ highlight.highlightCenterOffset = (distanceFromCenter / (currentItem.width / 4)) * units.gu(1);
208+ }
206209 }
207−
208210 }
211+
209212 property real highlightCenterOffset: 0
210213 Behavior on highlightCenterOffset {
211214 NumberAnimation { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
@@ -236,7 +239,7 @@ Item {
236239 Transition {
237240 PropertyAnimation {
238241 properties: "opacity";
239− duration: UbuntuAnimation.SnapDuration;
242+ duration: UbuntuAnimation.SnapDuration
240243 easing: UbuntuAnimation.StandardEasing
241244 }
242245 }
qml/Panel/IndicatorsBar.qml+5−3
@@ -14,8 +14,8 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
1919import "../Components"
2020
2121Item {
@@ -23,10 +23,10 @@ Item {
2323 property alias expanded: row.expanded
2424 property alias indicatorsModel: row.indicatorsModel
2525 property alias unitProgress: row.unitProgress
26− property real lateralPosition: -1
2726 property alias enableLateralChanges: row.enableLateralChanges
2827 property alias overFlowWidth: row.overFlowWidth
2928 readonly property alias currentItemIndex: row.currentItemIndex
29+ property real lateralPosition: -1
3030
3131 function selectItemAt(lateralPosition) {
3232 if (!expanded) {
@@ -37,6 +37,8 @@ Item {
3737 }
3838
3939 function updateItemFromLateralPosition(position) {
40+ if (position === -1) return;
41+
4042 var mapped = root.mapToItem(row, position, 0);
4143 row.updateItemFromLateralPosition(mapped.x);
4244 }
qml/Panel/IndicatorsMenu.qml+12−11
@@ -14,32 +14,32 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
1919import Ubuntu.Gestures 0.1
2020import "../Components"
2121
2222Showable {
2323 id: root
24+ property alias indicatorsModel: bar.indicatorsModel
25+ property alias showDragHandle: __showDragHandle
26+ property alias hideDragHandle: __hideDragHandle
27+ property alias overFlowWidth: bar.overFlowWidth
28+
2429 property int minimizedPanelHeight: units.gu(3)
2530 property int expandedPanelHeight: units.gu(7)
2631 property real openedHeight: units.gu(71)
27− readonly property int lockThreshold: openedHeight * (2 / 3)
28− property alias indicatorsModel: bar.indicatorsModel
29− property alias overFlowWidth: bar.overFlowWidth
30− property bool enableHint: true
31− property real showHintBottomMargin: 0
32− property bool contentEnabled: true
32+ readonly property real unitProgress: Math.max(0, (height - minimizedPanelHeight) / (openedHeight - minimizedPanelHeight))
3333 readonly property bool fullyOpened: unitProgress >= 1
3434 readonly property bool partiallyOpened: unitProgress > 0 && unitProgress < 1.0
3535 readonly property bool fullyClosed: unitProgress == 0
36− readonly property real unitProgress: Math.max(0, (height - minimizedPanelHeight) / (openedHeight - minimizedPanelHeight))
36+
37+ property bool enableHint: true
38+ property bool contentEnabled: true
3739 property color panelColor: "black"
3840
3941 signal showTapped(point position)
4042
41− property alias showDragHandle: __showDragHandle
42− property alias hideDragHandle: __hideDragHandle
4343
4444 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
4545 // use its own values. Need to ask design about this.
@@ -131,6 +131,7 @@ Showable {
131131 right: parent.right
132132 }
133133 expanded: false
134+ enableLateralChanges: false
134135 lateralPosition: -1
135136 unitProgress: root.unitProgress
136137
qml/Panel/MenuContent.qml+1−1
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
17+import QtQuick 2.2
1818import QtQuick.Layouts 1.1
1919import Ubuntu.Components 1.1
2020import Unity.Indicators 0.1 as Indicators
qml/Panel/Panel.qml+2−2
@@ -14,8 +14,8 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
17+import QtQuick 2.2
18+import Ubuntu.Components 1.1
1919import Unity.Application 0.1
2020import "../Components"
2121import "../Components/ListItems"
qml/Panel/PanelVelocityCalculator.qml+1−1
@@ -14,7 +14,7 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.0
17+import QtQuick 2.2
1818import Ubuntu.Gestures 0.1
1919
2020Item {