@@ -14,14 +14,28 @@ Item {
15 anchors { left: parent.left; top: parent.top; margins: units.gu(1) }
15 anchors { left: parent.left; top: parent.top; margins: units.gu(1) }
17+ // Information about the transformed item
17 property int itemIndex: 0
18 property int itemIndex: 0
19+ property real itemHeight: units.gu(10)
21+ // Information about the environment
18 property int totalItems: 0
22 property int totalItems: 0
19 property Item flickable: null
23 property Item flickable: null
20− property int margins: units.gu(5)
24+ property int sceneHeight: units.gu(20)
21− property int foldingAreaWidth: units.gu(10)
27+ property real spreadHeight: units.gu(10)
28+ property int spreadBottomOffset: units.gu(5)
29+ property int foldingAreaWidth: units.gu(10)
23 property int maxVisibleItems: 10
30 property int maxVisibleItems: 10
31+ property int margins: units.gu(5)
32+ property real stackScale: 0.04
33+ property int leftEndFoldedAngle: 70
34+ property int rightEndFoldedAngle: 65
35+ property int unfoldedAngle: 30
25 readonly property int flickableWidth: flickable ? flickable.width : 0
39 readonly property int flickableWidth: flickable ? flickable.width : 0
26 readonly property int flickableContentWidth: flickable ? flickable.contentWidth: 0
40 readonly property int flickableContentWidth: flickable ? flickable.contentWidth: 0
27 readonly property real flickableProgress: flickable ? flickable.contentX / (flickable.contentWidth - flickableWidth) : 0
41 readonly property real flickableProgress: flickable ? flickable.contentX / (flickable.contentWidth - flickableWidth) : 0
@@ -39,32 +53,25 @@ Item {
40 readonly property int unfoldedDistance: (contentWidth - foldingAreaWidth) / maxVisibleItems
54 readonly property int unfoldedDistance: (contentWidth - foldingAreaWidth) / maxVisibleItems
43 readonly property real progressSlice: 1 / totalItems;
56 readonly property real progressSlice: 1 / totalItems;
44 readonly property real startProgress: (index - maxVisibleItems/2) * progressSlice
57 readonly property real startProgress: (index - maxVisibleItems/2) * progressSlice
45 readonly property real endProgress: (index + maxVisibleItems/2) * progressSlice
58 readonly property real endProgress: (index + maxVisibleItems/2) * progressSlice
47−// readonly property real startX: index < maxVisibleItems ?
48−// margins + index * unfoldedDistance
49−// : contentWidth - foldingAreaWidth + (startLayout.value * foldingAreaWidth)
51 readonly property real startX: contentWidth - foldingAreaWidth + (startLayout.value * foldingAreaWidth)
60 readonly property real startX: contentWidth - foldingAreaWidth + (startLayout.value * foldingAreaWidth)
53−// readonly property real endX: totalItems - maxVisibleItems < index ?
54−// contentWidth - (totalItems - index) * unfoldedDistance
55−// : margins + foldingAreaWidth - (endLayout.value * foldingAreaWidth)
57 readonly property real endX: margins + foldingAreaWidth - (endLayout.value * foldingAreaWidth)
61 readonly property real endX: margins + foldingAreaWidth - (endLayout.value * foldingAreaWidth)
59 readonly property int animatedX: transitionCurve.value * (endX - startX) + startX
63 readonly property int animatedX: transitionCurve.value * (endX - startX) + startX
61− function desktopY(sceneHeight, itemHeight) {
65+ // The y offset we need to add because of scaled tiles in the stacks
62− return sceneHeight - itemHeight - (sceneHeight * 0.2);
66+ readonly property int yOffset: -spreadHeight * stackScale / 2
68+ readonly property int animatedY: sceneHeight - itemHeight - spreadBottomOffset +
69+ (leftFoldingAreaProgress > 0 ?
70+ linearAnimation(0, 1, yOffset, 0, leftFoldingAreaProgress)
71+ : rightFoldingAreaProgress > 0 ?
72+ linearAnimation(0, 1, yOffset, 0, rightFoldingAreaProgress)
65− property int leftEndFoldedAngle: 70
66− property int rightEndFoldedAngle: 65
67− property int unfoldedAngle: 30
69 // faw : 1 = x : p
76 // faw : 1 = x : p
70 property real leftFoldingAreaProgress: (foldingAreaWidth + margins - animatedX) / foldingAreaWidth
77 property real leftFoldingAreaProgress: (foldingAreaWidth + margins - animatedX) / foldingAreaWidth
@@ -79,21 +86,20 @@ Item {
79 linearAnimation(0, 1, unfoldedAngle, rightEndFoldedAngle, rightFoldingAreaProgress)
86 linearAnimation(0, 1, unfoldedAngle, rightEndFoldedAngle, rightFoldingAreaProgress)
80 : unfoldedAngle
87 : unfoldedAngle
82− onAnimatedAngleChanged: if (index == 10) print("**** animated angle", animatedAngle, rightFoldingAreaProgress)
90+ readonly property real scale: (leftFoldingAreaProgress > 0 ?
91+ linearAnimation(0, 1, spreadHeight * (1 - stackScale), spreadHeight, leftFoldingAreaProgress)
92+ : rightFoldingAreaProgress > 0 ?
93+ linearAnimation(0, 1, spreadHeight * (1 - stackScale), spreadHeight, rightFoldingAreaProgress)
94+ : spreadHeight * (1 - stackScale)
85− function desktopScale(sceneHeight, itemHeight) {
86− var maxHeight = sceneHeight * 0.35;
87− if (itemHeight > maxHeight) {
88− return maxHeight / itemHeight
93 function desktopTitleInfoShown(index, flickableX) {
98 function desktopTitleInfoShown(index, flickableX) {
94 return true;
99 return true;
97 function linearAnimation(startProgress, endProgress, startValue, endValue, progress) {
103 function linearAnimation(startProgress, endProgress, startValue, endValue, progress) {
98 // progress : progressDiff = value : valueDiff => value = progress * valueDiff / progressDiff
104 // progress : progressDiff = value : valueDiff => value = progress * valueDiff / progressDiff
99 return (progress - startProgress) * (endValue - startValue) / (endProgress - startProgress) + startValue;
105 return (progress - startProgress) * (endValue - startValue) / (endProgress - startProgress) + startValue;