on xenial help sign in
improve animation - highlight more broken atm though
4f69526Michael Zanetti
qml/Stages/DesktopStage.qml+7−3
@@ -270,7 +270,7 @@ FocusScope {
270 Flickable {
270 Flickable {
271 id: spreadFlickable
271 id: spreadFlickable
272 anchors.fill: parent
272 anchors.fill: parent
273− contentWidth: ApplicationManager.count * width / 5
273+ contentWidth: Math.max(6, ApplicationManager.count) * width / 5
274 visible: false
274 visible: false
275 //boundsBehavior: Flickable.StopAtBounds
275 //boundsBehavior: Flickable.StopAtBounds
276
276
@@ -292,7 +292,11 @@ FocusScope {
292
292
293 Label {
293 Label {
294 anchors { left: parent.left; bottom: parent.bottom; margins: units.gu(1) }
294 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+
296 color: "red"
300 color: "red"
297 fontSize: "x-large"
301 fontSize: "x-large"
298 z: 100
302 z: 100
@@ -311,7 +315,7 @@ FocusScope {
311 Transition {
315 Transition {
312 from: "*"
316 from: "*"
313 to: "altTab"
317 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) }
315 }
319 }
316 ]
320 ]
317}
321}
qml/Stages/SpreadMaths.qml+13−9
@@ -18,7 +18,7 @@ Item {
18 property int totalItems: 0
18 property int totalItems: 0
19 property Item flickable: null
19 property Item flickable: null
20 property int margins: units.gu(5)
20 property int margins: units.gu(5)
21− property int foldingAreaWidth: units.gu(5)
21+ property int foldingAreaWidth: units.gu(10)
22
22
23 property int maxVisibleItems: 5
23 property int maxVisibleItems: 5
24
24
@@ -32,16 +32,20 @@ Item {
32
32
33 // Internal
33 // Internal
34 readonly property real progressSlice: 1 / totalItems;
34 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
36 readonly property real endProgress: (index + 3) * progressSlice
36 readonly property real endProgress: (index + 3) * progressSlice
37
37
38− readonly property real startX: index < maxVisibleItems ?
38+// readonly property real startX: index < maxVisibleItems ?
39− margins + index * unfoldedDistance
39+// margins + index * unfoldedDistance
40− : contentWidth - foldingAreaWidth + (startLayout.value * foldingAreaWidth)
40+// : contentWidth - foldingAreaWidth + (startLayout.value * foldingAreaWidth)
41
41
42+ readonly property real startX: contentWidth - foldingAreaWidth + (startLayout.value * foldingAreaWidth)
43+
42− readonly property real endX: totalItems - maxVisibleItems < index ?
44+// readonly property real endX: totalItems - maxVisibleItems < index ?
43− contentWidth - (totalItems - index) * unfoldedDistance
45+// contentWidth - (totalItems - index) * unfoldedDistance
44− : margins + foldingAreaWidth - (endLayout.value * foldingAreaWidth)
46+// : margins + foldingAreaWidth - (endLayout.value * foldingAreaWidth)
47+
48+ readonly property real endX: margins + foldingAreaWidth - (endLayout.value * foldingAreaWidth)
45
49
46 readonly property int animatedX: transitionCurve.value * (endX - startX) + startX
50 readonly property int animatedX: transitionCurve.value * (endX - startX) + startX
47
51
@@ -76,7 +80,7 @@ Item {
76
80
77 EasingCurve {
81 EasingCurve {
78 id: transitionCurve
82 id: transitionCurve
79− type: easingCurve.InOutSine
83+ type: EasingCurve.InOutSine
80
84
81 readonly property real normalizedEndProgress: endProgress - startProgress
85 readonly property real normalizedEndProgress: endProgress - startProgress
82 readonly property real normalizedProgress: (root.flickableProgress - root.startProgress) / normalizedEndProgress
86 readonly property real normalizedProgress: (root.flickableProgress - root.startProgress) / normalizedEndProgress
tests/qmltests/tst_DesktopShell.qml+1
@@ -130,6 +130,7 @@ Item {
130 text: "Start all apps"
130 text: "Start all apps"
131 onClicked: {
131 onClicked: {
132 for (var i = 0; i < ApplicationManager.availableApplications.length; i++) {
132 for (var i = 0; i < ApplicationManager.availableApplications.length; i++) {
133+ print("starting", ApplicationManager.availableApplications[i])
133 ApplicationManager.startApplication(ApplicationManager.availableApplications[i])
134 ApplicationManager.startApplication(ApplicationManager.availableApplications[i])
134 }
135 }
135 }
136 }