on xenial help sign in
improve animation - highlight more broken atm though
commit4f6952690a17edbc3278e228032254338f2c60e8 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 27 Mar 2015, 16:45 (12 years ago) parentdf92548
3 files changed+21−12
qml/Stages/DesktopStage.qml+7−3 qml/Stages/SpreadMaths.qml+13−9 tests/qmltests/tst_DesktopShell.qml+1
qml/Stages/DesktopStage.qml+7−3
@@ -270,7 +270,7 @@ FocusScope {
270270 Flickable {
271271 id: spreadFlickable
272272 anchors.fill: parent
273− contentWidth: ApplicationManager.count * width / 5
273+ contentWidth: Math.max(6, ApplicationManager.count) * width / 5
274274 visible: false
275275 //boundsBehavior: Flickable.StopAtBounds
276276
@@ -292,7 +292,11 @@ FocusScope {
292292
293293 Label {
294294 anchors { left: parent.left; bottom: parent.bottom; margins: units.gu(1) }
295− text: "Progress: " + (spreadFlickable.contentX / (spreadFlickable.contentWidth - spreadFlickable.width))
295+ text: "Progress: " + (spreadFlickable.contentX / (spreadFlickable.contentWidth - spreadFlickable.width)).toFixed(3) +
296+ ", ContentX: " + spreadFlickable.contentX +
297+ ", Width: " + spreadFlickable.width +
298+ ", ContentWidth: " + spreadFlickable.contentWidth
299+
296300 color: "red"
297301 fontSize: "x-large"
298302 z: 100
@@ -311,7 +315,7 @@ FocusScope {
311315 Transition {
312316 from: "*"
313317 to: "altTab"
314− PropertyAction { target: spreadFlickable; property: "contentX"; value: 0 }
318+ PropertyAction { target: spreadFlickable; property: "contentX"; value: (1.88 / ApplicationManager.count) * (spreadFlickable.contentWidth - spreadFlickable.width) }
315319 }
316320 ]
317321}
qml/Stages/SpreadMaths.qml+13−9
@@ -18,7 +18,7 @@ Item {
1818 property int totalItems: 0
1919 property Item flickable: null
2020 property int margins: units.gu(5)
21− property int foldingAreaWidth: units.gu(5)
21+ property int foldingAreaWidth: units.gu(10)
2222
2323 property int maxVisibleItems: 5
2424
@@ -32,16 +32,20 @@ Item {
3232
3333 // Internal
3434 readonly property real progressSlice: 1 / totalItems;
35− readonly property real startProgress: Math.max(0, index - 2) * progressSlice
35+ readonly property real startProgress: (index - 2) * progressSlice
3636 readonly property real endProgress: (index + 3) * progressSlice
3737
38− readonly property real startX: index < maxVisibleItems ?
39− margins + index * unfoldedDistance
40− : contentWidth - foldingAreaWidth + (startLayout.value * foldingAreaWidth)
38+// readonly property real startX: index < maxVisibleItems ?
39+// margins + index * unfoldedDistance
40+// : contentWidth - foldingAreaWidth + (startLayout.value * foldingAreaWidth)
4141
42− readonly property real endX: totalItems - maxVisibleItems < index ?
43− contentWidth - (totalItems - index) * unfoldedDistance
44− : margins + foldingAreaWidth - (endLayout.value * foldingAreaWidth)
42+ readonly property real startX: contentWidth - foldingAreaWidth + (startLayout.value * foldingAreaWidth)
43+
44+// readonly property real endX: totalItems - maxVisibleItems < index ?
45+// contentWidth - (totalItems - index) * unfoldedDistance
46+// : margins + foldingAreaWidth - (endLayout.value * foldingAreaWidth)
47+
48+ readonly property real endX: margins + foldingAreaWidth - (endLayout.value * foldingAreaWidth)
4549
4650 readonly property int animatedX: transitionCurve.value * (endX - startX) + startX
4751
@@ -76,7 +80,7 @@ Item {
7680
7781 EasingCurve {
7882 id: transitionCurve
79− type: easingCurve.InOutSine
83+ type: EasingCurve.InOutSine
8084
8185 readonly property real normalizedEndProgress: endProgress - startProgress
8286 readonly property real normalizedProgress: (root.flickableProgress - root.startProgress) / normalizedEndProgress
tests/qmltests/tst_DesktopShell.qml+1
@@ -130,6 +130,7 @@ Item {
130130 text: "Start all apps"
131131 onClicked: {
132132 for (var i = 0; i < ApplicationManager.availableApplications.length; i++) {
133+ print("starting", ApplicationManager.availableApplications[i])
133134 ApplicationManager.startApplication(ApplicationManager.availableApplications[i])
134135 }
135136 }