@@ -4,6 +4,7 @@ import Ubuntu.Components 0.1
5SpreadDelegate {
5SpreadDelegate {
8 property bool selected: false
9 property bool selected: false
9 property bool otherSelected: false
10 property bool otherSelected: false
@@ -42,12 +43,16 @@ SpreadDelegate {
42 if (spreadView.stage == 1) {
43 if (spreadView.stage == 1) {
43 if (index == 0) {
44 if (index == 0) {
44 priv.stage2startTranslate = priv.easingAnimation(0, spreadView.positionMarker4, 0, -spreadView.width, spreadView.positionMarker4) + spreadView.width;
45 priv.stage2startTranslate = priv.easingAnimation(0, spreadView.positionMarker4, 0, -spreadView.width, spreadView.positionMarker4) + spreadView.width;
46+ priv.stage2startAngle = priv.easingAnimation(0, spreadView.positionMarker4, root.startAngle, root.endAngle, spreadView.positionMarker4)
47+ priv.stage2startScale = priv.easingAnimation(0, spreadView.positionMarker4, root.startScale, root.endScale, spreadView.positionMarker4)
48+ priv.stage2startTopMarginProgress = priv.linearAnimation(0, 1, 0, 1, spreadView.positionMarker4)
45 } else if (index == 1) {
49 } else if (index == 1) {
46 // find where the main easing for Tile 1 would be when reaching stage 2
50 // find where the main easing for Tile 1 would be when reaching stage 2
47 var stage2Progress = spreadView.positionMarker4 - spreadView.tileDistance / spreadView.width;
51 var stage2Progress = spreadView.positionMarker4 - spreadView.tileDistance / spreadView.width;
48 priv.stage2startTranslate = priv.easingAnimation(0, stage2Progress, 0, -spreadView.width + root.endDistance, stage2Progress);
52 priv.stage2startTranslate = priv.easingAnimation(0, stage2Progress, 0, -spreadView.width + root.endDistance, stage2Progress);
49 priv.stage2startAngle = priv.easingAnimation(0, stage2Progress, root.startAngle, root.endAngle, stage2Progress)
53 priv.stage2startAngle = priv.easingAnimation(0, stage2Progress, root.startAngle, root.endAngle, stage2Progress)
50 priv.stage2startScale = priv.easingAnimation(0, stage2Progress, root.startScale, root.endScale, stage2Progress);
54 priv.stage2startScale = priv.easingAnimation(0, stage2Progress, root.startScale, root.endScale, stage2Progress);
55+ priv.stage2startTopMarginProgress = priv.linearAnimation(0, 1, 0, spreadView.positionMarker4, stage2Progress)
@@ -62,12 +67,14 @@ SpreadDelegate {
62 property real selectedAngle
67 property real selectedAngle
63 property real selectedScale
68 property real selectedScale
64 property real selectedOpacity
69 property real selectedOpacity
70+ property real selectedTopMarginProgress
66 // Those values are needed as target values for the end of stage 1.
72 // Those values are needed as target values for the end of stage 1.
67 // As they are static values, lets caluclate them once when entering stage 1 instead of calculating them in each animation pass.
73 // As they are static values, lets caluclate them once when entering stage 1 instead of calculating them in each animation pass.
68 property real stage2startTranslate
74 property real stage2startTranslate
69 property real stage2startAngle
75 property real stage2startAngle
70 property real stage2startScale
76 property real stage2startScale
77+ property real stage2startTopMarginProgress
72 function snapshot() {
79 function snapshot() {
73 selectedProgress = root.progress;
80 selectedProgress = root.progress;
@@ -75,6 +82,7 @@ SpreadDelegate {
75 selectedAngle = angle;
82 selectedAngle = angle;
76 selectedScale = scale;
83 selectedScale = scale;
77 selectedOpacity = opacity;
84 selectedOpacity = opacity;
85+ selectedTopMarginProgress = topMarginProgress;
80 property real negativeProgress: {
88 property real negativeProgress: {
@@ -85,7 +93,7 @@ SpreadDelegate {
87 function linearAnimation(startProgress, endProgress, startValue, endValue, progress) {
95 function linearAnimation(startProgress, endProgress, startValue, endValue, progress) {
88− // progress : progressDiff = value : valueDiff
96+ // progress : progressDiff = value : valueDiff => value = progress * valueDiff / progressDiff
89 return (progress - startProgress) * (endValue - startValue) / (endProgress - startProgress) + startValue;
97 return (progress - startProgress) * (endValue - startValue) / (endProgress - startProgress) + startValue;
@@ -147,7 +155,7 @@ SpreadDelegate {
147 newAngle = linearAnimation(0, spreadView.positionMarker2, 0, root.endAngle * spreadView.snapPosition, root.animatedProgress)
155 newAngle = linearAnimation(0, spreadView.positionMarker2, 0, root.endAngle * spreadView.snapPosition, root.animatedProgress)
149 } else if (spreadView.stage == 1) {
157 } else if (spreadView.stage == 1) {
150− newAngle = linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, root.endAngle * spreadView.snapPosition, root.endAngle, root.progress)
158+ newAngle = linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, root.endAngle * spreadView.snapPosition, stage2startAngle, root.progress)
@@ -176,7 +184,7 @@ SpreadDelegate {
176 newScale = 1;
184 newScale = 1;
178 } else if(spreadView.stage == 1) {
186 } else if(spreadView.stage == 1) {
179− newScale = linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, 1, root.endScale, root.progress)
187+ newScale = linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, 1, stage2startScale, root.progress)
@@ -212,6 +220,30 @@ SpreadDelegate {
213 return 1;
221 return 1;
224+ property real topMarginProgress: {
226+ return linearAnimation(selectedProgress, negativeProgress, selectedTopMarginProgress, 0, root.progress);
231+ if (spreadView.stage == 0) {
233+ } else if (spreadView.stage == 1) {
234+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, 0, priv.stage2startTopMarginProgress, root.progress);
238+ if (spreadView.stage == 0) {
240+ } else if (spreadView.stage == 1) {
241+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, 0, priv.stage2startTopMarginProgress, root.progress);
245+ return root.progress;
217 transform: [
249 transform: [
@@ -230,6 +262,7 @@ SpreadDelegate {
232 opacity: priv.opacity
264 opacity: priv.opacity
265+ topMarginProgress: priv.topMarginProgress
234 EasingCurve {
267 EasingCurve {
235 id: easingCurve
268 id: easingCurve