on xenial help sign in
experiment with linear movement and folding on both ends
f15cc28Michael Zanetti
qml/Stages/DesktopStage.qml+2−2
@@ -46,7 +46,7 @@ FocusScope {
46 if (root.altTabPressed) {
46 if (root.altTabPressed) {
47 print("should tab next")
47 print("should tab next")
48 appRepeater.highlightedIndex = (appRepeater.highlightedIndex + 1) % ApplicationManager.count
48 appRepeater.highlightedIndex = (appRepeater.highlightedIndex + 1) % ApplicationManager.count
49− spreadFlickable.snapTo(spreadFlickable.width / 5 * Math.max(0, appRepeater.highlightedIndex - 3))
49+ spreadFlickable.snapTo(spreadFlickable.width / 5 * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 2)))
50 }
50 }
51 }
51 }
52
52
@@ -55,7 +55,7 @@ FocusScope {
55 if (root.altTabPressed) {
55 if (root.altTabPressed) {
56 var newIndex = appRepeater.highlightedIndex - 1 >= 0 ? appRepeater.highlightedIndex - 1 : ApplicationManager.count - 1;
56 var newIndex = appRepeater.highlightedIndex - 1 >= 0 ? appRepeater.highlightedIndex - 1 : ApplicationManager.count - 1;
57 appRepeater.highlightedIndex = newIndex;
57 appRepeater.highlightedIndex = newIndex;
58− spreadFlickable.snapTo(spreadFlickable.width / 5 * Math.max(0, appRepeater.highlightedIndex - 3))
58+ spreadFlickable.snapTo(spreadFlickable.width / 5 * Math.max(0, Math.min(ApplicationManager.count - 5, appRepeater.highlightedIndex - 2)))
59 }
59 }
60 }
60 }
61
61
qml/Stages/SpreadMaths.qml+15−1
@@ -1,11 +1,25 @@
1import QtQuick 2.2
1import QtQuick 2.2
2import Utils 0.1
2import Utils 0.1
3+import Unity.Application 0.1
3
4
4QtObject {
5QtObject {
5 id: root
6 id: root
6
7
7 function desktopX(index, totalWidth, flickableX) {
8 function desktopX(index, totalWidth, flickableX) {
9+ var margins = units.gu(5);
8− var distance = totalWidth / 5;
10+ var distance = (totalWidth - margins * 2) / 5;
11+ var foldedDistance = units.gu(0.5)
12+ var reverseIndex = ApplicationManager.count - index
13+
14+ var x = (index * distance) - flickableX + margins;
15+ // limit at left
16+ x = Math.max(margins + foldedDistance * index, x);
17+ // limit at right
18+ x = Math.min(totalWidth - margins - distance - foldedDistance * reverseIndex, x);
19+
20+ return x
21+
22+
9 var startProgress = 0;
23 var startProgress = 0;
10 var endProgress = 1;
24 var endProgress = 1;
11 var startValue = index * distance;
25 var startValue = index * distance;