on xenial help sign in
added missing ; at imperative line endings
commit503fad12565d25ad9820c46012d8de645af1c3ed authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 19 Mar 2014, 10:32 (13 years ago) parentca4d788
3 files changed+71−49
qml/Stages/PhoneStage.qml+15−15 qml/Stages/SpreadDelegate.qml+6−1 qml/Stages/TransformedSpreadDelegate.qml+50−33
qml/Stages/PhoneStage.qml+15−15
@@ -44,7 +44,7 @@ Item {
4444 priv.requestNewScreenshot();
4545 } else {
4646 mainScreenshotImage.anchors.leftMargin = 0;
47− mainScreenshotImage.src = ApplicationManager.get(0).screenshot
47+ mainScreenshotImage.src = ApplicationManager.get(0).screenshot;
4848 mainScreenshotImage.visible = true;
4949 }
5050 } else {
@@ -57,7 +57,7 @@ Item {
5757
5858 onFocusRequested: {
5959 if (spreadView.visible) {
60− spreadView.snapTo(priv.indexOf(appId))
60+ spreadView.snapTo(priv.indexOf(appId));
6161 } else {
6262 priv.switchToApp(appId);
6363 }
@@ -68,12 +68,12 @@ Item {
6868 if (priv.secondApplicationStarting || priv.applicationStarting) {
6969 appSplashTimer.start();
7070 } else {
71− var application = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId)
72− root.fullscreen = application.fullscreen
73− mainScreenshotImage.src = application.screenshot
71+ var application = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId);
72+ root.fullscreen = application.fullscreen;
73+ mainScreenshotImage.src = application.screenshot;
7474 }
7575 } else {
76− spreadView.selectedIndex = -1
76+ spreadView.selectedIndex = -1;
7777 spreadView.stage = 0;
7878 spreadView.contentX = -spreadView.shift;
7979 }
@@ -92,7 +92,7 @@ Item {
9292 }
9393
9494 if (spreadView.visible) {
95− spreadView.snapTo(0)
95+ spreadView.snapTo(0);
9696 }
9797 }
9898
@@ -101,7 +101,7 @@ Item {
101101 mainScreenshotImage.src = ""
102102 mainScreenshotImage.visible = false;
103103 } else {
104− mainScreenshotImage.src = ApplicationManager.get(0).screenshot
104+ mainScreenshotImage.src = ApplicationManager.get(0).screenshot;
105105 }
106106 }
107107 }
@@ -256,13 +256,13 @@ Item {
256256 spreadView.contentX = -spreadView.shift;
257257 }
258258 if (dragging && attachedToView) {
259− spreadView.contentX = -touchX - spreadView.shift
259+ spreadView.contentX = -touchX - spreadView.shift;
260260 }
261261 if (attachedToView && spreadView.shiftedContentX >= spreadView.width * spreadView.positionMarker3) {
262262 attachedToView = false;
263263 spreadView.snap();
264264 }
265− gesturePoints.push(touchX)
265+ gesturePoints.push(touchX);
266266 }
267267
268268 onStatusChanged: {
@@ -284,7 +284,7 @@ Item {
284284 gesturePoints = [];
285285
286286 if (oneWayFlick && spreadView.shiftedContentX > units.gu(2) && spreadView.shiftedContentX < spreadView.positionMarker1 * spreadView.width) {
287− spreadView.snapTo(1)
287+ spreadView.snapTo(1);
288288 } else if (!dragging && attachedToView) {
289289 spreadView.snap();
290290 }
@@ -432,10 +432,10 @@ Item {
432432 // Each tile has a different progress value running from 0 to 1.
433433 // A progress value of 0 means the tile is at the right edge. 1 means the tile has reched the left edge.
434434 progress: {
435− var tileProgress = (spreadView.shiftedContentX - index * spreadView.tileDistance) / spreadView.width
435+ var tileProgress = (spreadView.shiftedContentX - index * spreadView.tileDistance) / spreadView.width;
436436 // Tile 1 needs to move directly from the beginning...
437437 if (index == 1 && spreadView.stage < 2) {
438− tileProgress += spreadView.tileDistance / spreadView.width
438+ tileProgress += spreadView.tileDistance / spreadView.width;
439439 }
440440 return tileProgress;
441441 }
@@ -446,9 +446,9 @@ Item {
446446 if (progress < spreadView.positionMarker1) {
447447 return progress;
448448 } else if (progress < spreadView.positionMarker1 + snappingCurve.period){
449− return spreadView.positionMarker1 + snappingCurve.value * 3
449+ return spreadView.positionMarker1 + snappingCurve.value * 3;
450450 } else {
451− return spreadView.positionMarker2
451+ return spreadView.positionMarker2;
452452 }
453453 }
454454 return progress;
qml/Stages/SpreadDelegate.qml+6−1
@@ -39,7 +39,12 @@ Item {
3939 }
4040 Image {
4141 id: appImage
42− anchors { left: parent.left; bottom: parent.bottom; top: parent.top; topMargin: priv.heightDifference * Math.max(0, 1 - root.topMarginProgress) }
42+ anchors {
43+ left: parent.left;
44+ bottom: parent.bottom;
45+ top: parent.top;
46+ topMargin: priv.heightDifference * Math.max(0, 1 - root.topMarginProgress)
47+ }
4348 source: model.screenshot
4449 antialiasing: true
4550 scale: 1
qml/Stages/TransformedSpreadDelegate.qml+50−33
@@ -62,16 +62,16 @@ SpreadDelegate {
6262 if (spreadView.stage == 1) {
6363 if (index == 0) {
6464 priv.stage2startTranslate = priv.easingAnimation(0, spreadView.positionMarker4, 0, -spreadView.width, spreadView.positionMarker4) + spreadView.width;
65− priv.stage2startAngle = priv.easingAnimation(0, spreadView.positionMarker4, root.startAngle, root.endAngle, spreadView.positionMarker4)
66− priv.stage2startScale = priv.easingAnimation(0, spreadView.positionMarker4, root.startScale, root.endScale, spreadView.positionMarker4)
67− priv.stage2startTopMarginProgress = priv.easingAnimation(0, 1, 0, 1, spreadView.positionMarker4)
65+ priv.stage2startAngle = priv.easingAnimation(0, spreadView.positionMarker4, root.startAngle, root.endAngle, spreadView.positionMarker4);
66+ priv.stage2startScale = priv.easingAnimation(0, spreadView.positionMarker4, root.startScale, root.endScale, spreadView.positionMarker4);
67+ priv.stage2startTopMarginProgress = priv.easingAnimation(0, 1, 0, 1, spreadView.positionMarker4);
6868 } else if (index == 1) {
6969 // find where the main easing for Tile 1 would be when reaching stage 2
7070 var stage2Progress = spreadView.positionMarker4 - spreadView.tileDistance / spreadView.width;
7171 priv.stage2startTranslate = priv.easingAnimation(0, stage2Progress, 0, -spreadView.width + root.endDistance, stage2Progress);
72− priv.stage2startAngle = priv.easingAnimation(0, stage2Progress, root.startAngle, root.endAngle, stage2Progress)
72+ priv.stage2startAngle = priv.easingAnimation(0, stage2Progress, root.startAngle, root.endAngle, stage2Progress);
7373 priv.stage2startScale = priv.easingAnimation(0, stage2Progress, root.startScale, root.endScale, stage2Progress);
74− priv.stage2startTopMarginProgress = priv.easingAnimation(0, 1, 0, spreadView.positionMarker4, stage2Progress)
74+ priv.stage2startTopMarginProgress = priv.easingAnimation(0, 1, 0, spreadView.positionMarker4, stage2Progress);
7575 }
7676 }
7777 }
@@ -127,7 +127,7 @@ SpreadDelegate {
127127 property real xTranslate: {
128128 if (otherSelected) {
129129 if (spreadView.stage < 2 && index == 0) {
130− return linearAnimation(selectedProgress, negativeProgress, selectedXTranslate, selectedXTranslate - spreadView.tileDistance, root.progress)
130+ return linearAnimation(selectedProgress, negativeProgress, selectedXTranslate, selectedXTranslate - spreadView.tileDistance, root.progress);
131131 }
132132
133133 return selectedXTranslate;
@@ -136,60 +136,70 @@ SpreadDelegate {
136136 switch (index) {
137137 case 0:
138138 if (spreadView.stage == 0) {
139− return Math.min(0, linearAnimation(0, spreadView.positionMarker2, 0, -spreadView.width * .25, root.animatedProgress))
139+ return Math.min(0, linearAnimation(0, spreadView.positionMarker2,
140+ 0, -spreadView.width * .25, root.animatedProgress));
140141 } else if (spreadView.stage == 1){
141− return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, -spreadView.width * .25, priv.stage2startTranslate, root.progress)
142+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
143+ -spreadView.width * .25, priv.stage2startTranslate, root.progress);
142144 } else if (!priv.isSelected){ // Stage 2
143145 // Apply the same animation as with the rest but add spreadView.width to align it with the others.
144− return -easingCurve.value * spreadView.width + spreadView.width
146+ return -easingCurve.value * spreadView.width + spreadView.width;
145147 } else if (priv.isSelected) {
146− return linearAnimation(selectedProgress, negativeProgress, selectedXTranslate, 0, root.progress)
148+ return linearAnimation(selectedProgress, negativeProgress, selectedXTranslate, 0, root.progress);
147149 }
148150
149151 case 1:
150152 if (spreadView.stage == 0 && !priv.isSelected) {
151− return linearAnimation(0, spreadView.positionMarker2, 0, -spreadView.width * spreadView.snapPosition, root.animatedProgress)
153+ return linearAnimation(0, spreadView.positionMarker2,
154+ 0, -spreadView.width * spreadView.snapPosition, root.animatedProgress);
152155 } else if (spreadView.stage == 1 && !priv.isSelected) {
153156 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
154− -spreadView.width * spreadView.snapPosition, priv.stage2startTranslate, root.progress);
157+ -spreadView.width * spreadView.snapPosition, priv.stage2startTranslate,
158+ root.progress);
155159 }
156160 }
157161
158162 if (priv.isSelected) {
159163 // Distance to left edge
160− var targetTranslate = -spreadView.width - ((index - 1) * root.startDistance)
161− return linearAnimation(selectedProgress, negativeProgress, selectedXTranslate, targetTranslate, root.progress)
164+ var targetTranslate = -spreadView.width - ((index - 1) * root.startDistance);
165+ return linearAnimation(selectedProgress, negativeProgress,
166+ selectedXTranslate, targetTranslate, root.progress);
162167 }
163168
164169 // Fix it at the right edge...
165− var rightEdgeOffset = -((index - 1) * root.startDistance)
170+ var rightEdgeOffset = -((index - 1) * root.startDistance);
166171 // ...and use our easing to move them to the left. Stop a bit earlier for each tile
167− return -easingCurve.value * spreadView.width + (index * animatedEndDistance) + rightEdgeOffset
172+ return -easingCurve.value * spreadView.width + (index * animatedEndDistance) + rightEdgeOffset;
168173
169174 }
170175
171176 property real angle: {
172177 if (priv.otherSelected) {
173− return priv.selectedAngle
178+ return priv.selectedAngle;
174179 }
175180 if (priv.isSelected) {
176− return linearAnimation(selectedProgress, negativeProgress, selectedAngle, 0, root.progress)
181+ return linearAnimation(selectedProgress, negativeProgress, selectedAngle, 0, root.progress);
177182 }
178183 switch (index) {
179184 case 0:
180185 if (spreadView.stage == 0) {
181− return Math.max(0, linearAnimation(0, spreadView.positionMarker2, 0, root.tile0SnapAngle, root.animatedProgress))
186+ return Math.max(0, linearAnimation(0, spreadView.positionMarker2,
187+ 0, root.tile0SnapAngle, root.animatedProgress));
182188 } else if (spreadView.stage == 1) {
183− return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, root.tile0SnapAngle, stage2startAngle, root.progress)
189+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
190+ root.tile0SnapAngle, stage2startAngle, root.progress);
184191 }
185192 case 1:
186193 if (spreadView.stage == 0) {
187− return linearAnimation(0, spreadView.positionMarker2, root.startAngle, root.startAngle * (1-spreadView.snapPosition), root.animatedProgress)
194+ return linearAnimation(0, spreadView.positionMarker2, root.startAngle,
195+ root.startAngle * (1-spreadView.snapPosition), root.animatedProgress);
188196 } else if (spreadView.stage == 1) {
189− return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, root.startAngle * (1-spreadView.snapPosition), priv.stage2startAngle, root.progress)
197+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
198+ root.startAngle * (1-spreadView.snapPosition), priv.stage2startAngle,
199+ root.progress);
190200 }
191201 }
192− return root.startAngle - easingCurve.value * (root.startAngle - root.endAngle)
202+ return root.startAngle - easingCurve.value * (root.startAngle - root.endAngle);
193203 }
194204
195205 property real scale: {
@@ -197,7 +207,7 @@ SpreadDelegate {
197207 return priv.selectedScale;
198208 }
199209 if (priv.isSelected) {
200− return linearAnimation(selectedProgress, negativeProgress, selectedScale, 1, root.progress)
210+ return linearAnimation(selectedProgress, negativeProgress, selectedScale, 1, root.progress);
201211 }
202212
203213 switch (index) {
@@ -205,30 +215,35 @@ SpreadDelegate {
205215 if (spreadView.stage == 0) {
206216 return 1;
207217 } else if(spreadView.stage == 1) {
208− return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, 1, stage2startScale, root.progress)
218+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
219+ 1, stage2startScale, root.progress);
209220 }
210221 case 1:
211222 if (spreadView.stage == 0) {
212223 var targetScale = tile1StartScale - ((tile1StartScale - 1) * spreadView.snapPosition);
213− return linearAnimation(0, spreadView.positionMarker2, root.tile1StartScale, targetScale, root.animatedProgress)
224+ return linearAnimation(0, spreadView.positionMarker2,
225+ root.tile1StartScale, targetScale, root.animatedProgress);
214226 } else if (spreadView.stage == 1) {
215227 var startScale = tile1StartScale - ((tile1StartScale - 1) * spreadView.snapPosition);
216− return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, startScale, priv.stage2startScale, root.progress)
228+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
229+ startScale, priv.stage2startScale, root.progress);
217230 }
218231 }
219− return root.startScale - easingCurve.value * (root.startScale - root.endScale)
232+ return root.startScale - easingCurve.value * (root.startScale - root.endScale);
220233 }
221234
222235 property real opacity: {
223236 if (otherSelected) {
224− return linearAnimation (selectedProgress, Math.max(0, selectedProgress - .5), selectedOpacity, 0, root.progress)
237+ return linearAnimation (selectedProgress, Math.max(0, selectedProgress - .5),
238+ selectedOpacity, 0, root.progress);
225239 }
226240 if (index == 0) {
227241 switch (spreadView.stage) {
228242 case 0:
229− return linearAnimation(0, spreadView.positionMarker2, 1, .3, root.animatedProgress)
243+ return linearAnimation(0, spreadView.positionMarker2, 1, .3, root.animatedProgress);
230244 case 1:
231− return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, .3, 1, root.animatedProgress)
245+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
246+ .3, 1, root.animatedProgress);
232247 }
233248 }
234249
@@ -245,14 +260,16 @@ SpreadDelegate {
245260 if (spreadView.stage == 0) {
246261 return 0;
247262 } else if (spreadView.stage == 1) {
248− return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, 0, priv.stage2startTopMarginProgress, root.progress);
263+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
264+ 0, priv.stage2startTopMarginProgress, root.progress);
249265 }
250266 break;
251267 case 1:
252268 if (spreadView.stage == 0) {
253269 return 0;
254270 } else if (spreadView.stage == 1) {
255− return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, 0, priv.stage2startTopMarginProgress, root.progress);
271+ return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
272+ 0, priv.stage2startTopMarginProgress, root.progress);
256273 }
257274 }
258275