on xenial help sign in
sync progress for tablet right edge from trunk
commit28eaf6c880b29e425d5b435ec1c520517bfa090a authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 3 Jun 2014, 16:50 (12 years ago) parent3ca11a0
2 files changed+22−11
qml/Stages/TabletStage.qml+6−5 qml/Stages/TransformedTabletSpreadDelegate.qml+16−6
qml/Stages/TabletStage.qml+6−5
@@ -226,8 +226,8 @@ Item {
226226 snapAnimation.start();
227227 } else if (contentX < phase1Width) {
228228 snapTo(1)
229− } else if (contentX < phase1Width + units.gu(5)) {
230− snapTo(1)
229+// } else if (contentX < phase1Width + units.gu(5)) {
230+// snapTo(1)
231231 } else {
232232 // Add 1 pixel to make sure we definitely hit positionMarker4 even with rounding errors of the animation.
233233 snapAnimation.targetContentX = spreadView.width * spreadView.positionMarker4 + 1;
@@ -246,7 +246,6 @@ Item {
246246 // We don't want to really reorder them in the model because that allows us to keep track
247247 // of the last focused order.
248248 function indexToZIndex(index) {
249− print("zindex asked", index)
250249 var app = ApplicationManager.get(index);
251250 var isActive = app.appId == priv.mainStageAppId || app.appId == priv.sideStageAppId;
252251 if (isActive && app.stage == ApplicationInfoInterface.MainStage) return 0;
@@ -478,12 +477,14 @@ Item {
478477 // no matter if we didn't cross positionMarker1 yet.
479478 spreadView.snapTo(spreadView.nextInStack);
480479 } else if (!dragging && attachedToView) {
481− if (spreadView.contentX / spreadView.width < spreadView.positionMarker1) {
480+ if (spreadView.contentX < spreadView.width * spreadView.positionMarker1) {
482481 spreadView.snap();
482+ } else if (spreadView.contentX < spreadView.width * spreadView.positionMarker2) {
483+ spreadView.snapTo(spreadView.nextInStack)
483484 } else {
484485 // otherwise snap to the closest snap position we can find
485486 // (might be back to start, to app 1 or to spread)
486− spreadView.snapTo(spreadView.nextInStack);
487+ spreadView.snap();
487488 }
488489 }
489490 }
qml/Stages/TransformedTabletSpreadDelegate.qml+16−6
@@ -142,10 +142,15 @@ SpreadDelegate {
142142 }
143143 }
144144
145+ // The tile should move a bit to the left if a new one comes on top of it, but not for the Side Stage and not
146+ // when we're only dragging the side stage in on top of a main stage app
147+ var shouldMoveAway = priv.movedActive && model.stage === ApplicationInfoInterface.MainStage &&
148+ ApplicationManager.get(spreadView.nextInStack).stage === ApplicationInfoInterface.MainStage
149+
145150 if (active) {
146151 newTranslate -= root.width
147−// print("nextZ", spreadView.nextZInStack, "this z", root.zIndex, index, root.animatedProgress)
148− if (spreadView.phase == 0 && priv.movedActive) {
152+ // Only do the hide animation for active apps in the mainstage, and not if we only drag the ss in
153+ if (spreadView.phase == 0 && shouldMoveAway) {
149154 newTranslate += linearAnimation(0, spreadView.positionMarker2, 0, -units.gu(4), root.animatedProgress)
150155 }
151156 }
@@ -169,7 +174,6 @@ SpreadDelegate {
169174 if (nextInStack) {
170175 if (model.stage == ApplicationInfoInterface.MainStage) {
171176 var startValue = -spreadView.sideStageWidth * spreadView.snapPosition + (spreadView.sideStageVisible ? -spreadView.sideStageWidth : 0)
172−// var endValue = -spreadView.width + spreadView.width * root.zIndex / 6;
173177 newTranslate += linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4, startValue, priv.phase2StartTranslate, root.animatedProgress);
174178 } else {
175179 var endValue = -spreadView.width + spreadView.width * root.zIndex / 6;
@@ -182,7 +186,7 @@ SpreadDelegate {
182186 } else if (root.active) {
183187 var startProgress = spreadView.positionMarker2 - (zIndex * spreadView.positionMarker2 / 2)
184188 var endProgress = spreadView.positionMarker4 - (zIndex * spreadView.tileDistance / spreadView.width)
185− var startTranslate = -root.width + (priv.movedActive ? -units.gu(4) : 0)
189+ var startTranslate = -root.width + (shouldMoveAway ? -units.gu(4) : 0)
186190 newTranslate = linearAnimation(startProgress, endProgress, startTranslate, priv.phase2StartTranslate, root.progress);
187191 } else {
188192 var startProgress = spreadView.positionMarker2 - (zIndex * spreadView.positionMarker2 / 2)
@@ -250,15 +254,20 @@ SpreadDelegate {
250254 return linearAnimation(selectedProgress, negativeProgress, selectedAngle, 0, root.progress)
251255 }
252256
257+ // The tile should rotate a bit when another one comes on top, but not when only dragging the side stage in
258+ var shouldMoveAway = movedActive && (ApplicationManager.get(spreadView.nextInStack).stage === ApplicationInfoInterface.MainStage || model.stage == ApplicationInfoInterface.SideStage)
259+
253260 if (spreadView.phase == 0) {
254261 if (nextInStack) {
255262 if (model.stage == ApplicationInfoInterface.SideStage && !spreadView.sideStageVisible) {
256263 return 0;
257264 } else {
258−// print("return angle for index", root.zIndex, linearAnimation(0, spreadView.positionMarker2, root.startAngle, root.startAngle * (1-spreadView.snapPosition), root.animatedProgress))
259265 return linearAnimation(0, spreadView.positionMarker2, root.startAngle, root.startAngle * (1-spreadView.snapPosition), root.animatedProgress)
260266 }
261267 }
268+ if (shouldMoveAway) {
269+ return linearAnimation(0, spreadView.positionMarker2, 0, root.startAngle * (1-spreadView.snapPosition), root.animatedProgress)
270+ }
262271 }
263272 if (spreadView.phase == 1) {
264273 if (nextInStack) {
@@ -270,7 +279,8 @@ SpreadDelegate {
270279 }
271280 var startProgress = spreadView.positionMarker2 - (zIndex * spreadView.positionMarker2 / 2)
272281 var endProgress = spreadView.positionMarker4 - (zIndex * spreadView.tileDistance / spreadView.width)
273− return linearAnimation(startProgress, endProgress, 0, priv.phase2StartAngle, root.progress)
282+ var startAngle = shouldMoveAway ? root.startAngle * (1-spreadView.snapPosition) : 0
283+ return linearAnimation(startProgress, endProgress, startAngle, priv.phase2StartAngle, root.progress)
274284 }
275285 if (spreadView.phase == 2) {
276286 return root.startAngle - easingCurve.value * (root.startAngle - root.endAngle);