on xenial help sign in
more progress on the tablet right edge
c392e3cMichael Zanetti
qml/Stages/TabletStage.qml+72−92
@@ -177,6 +177,7 @@ Item {
177 print("unhandled nextInStack case!!!!!");
177 print("unhandled nextInStack case!!!!!");
178 return -1;
178 return -1;
179 }
179 }
180+ property int nextZInStack: indexToZIndex(nextInStack)
180 onNextInStackChanged: print("next in stack is", nextInStack)
181 onNextInStackChanged: print("next in stack is", nextInStack)
181
182
182 states: [
183 states: [
@@ -241,6 +242,33 @@ Item {
241 snapAnimation.start();
242 snapAnimation.start();
242 }
243 }
243
244
245+ // We need to shuffle z ordering a bit in order to keep side stage apps above main stage apps.
246+ // We don't want to really reorder them in the model because that allows us to keep track
247+ // of the last focused order.
248+ function indexToZIndex(index) {
249+ print("zindex asked", index)
250+ var app = ApplicationManager.get(index);
251+ var isActive = app.appId == priv.mainStageAppId || app.appId == priv.sideStageAppId;
252+ if (isActive && app.stage == ApplicationInfoInterface.MainStage) return 0;
253+ if (isActive && app.stage == ApplicationInfoInterface.SideStage) {
254+ if (spreadView.nextInStack >= 0 && ApplicationManager.get(spreadView.nextInStack).stage == ApplicationInfoInterface.MainStage) {
255+ return Math.max(index, 2);
256+ } else {
257+ return 1;
258+ }
259+ }
260+ if (index <= 2 && app.stage == ApplicationInfoInterface.MainStage && priv.sideStageAppId) {
261+ return priv.indexOf(priv.sideStageAppId) < index ? index - 1 : index;
262+ }
263+ if (index == spreadView.nextInStack && app.stage == ApplicationInfoInterface.SideStage) {
264+ if (priv.sideStageAppId) {
265+ return 2;
266+ }
267+ return 1;
268+ }
269+ return index;
270+ }
271+
244 SequentialAnimation {
272 SequentialAnimation {
245 id: snapAnimation
273 id: snapAnimation
246 property int targetContentX: 0
274 property int targetContentX: 0
@@ -271,7 +299,7 @@ Item {
271 x: spreadView.contentX
299 x: spreadView.contentX
272 height: root.height
300 height: root.height
273// width: root.width
301// width: root.width
274− width: spreadView.width + Math.max(4, ApplicationManager.count) * spreadView.tileDistance
302+ width: spreadView.width + Math.max(spreadView.width, ApplicationManager.count * spreadView.tileDistance)
275
303
276 color: "black"
304 color: "black"
277
305
@@ -279,107 +307,59 @@ Item {
279 id: spreadRepeater
307 id: spreadRepeater
280 model: ApplicationManager
308 model: ApplicationManager
281
309
282− delegate: Rectangle {
310+ delegate: TransformedTabletSpreadDelegate {
311+ id: spreadTile
283 height: spreadView.height
312 height: spreadView.height
284− width: spreadView.tileDistance
313+ width: model.stage == ApplicationInfoInterface.MainStage ? spreadView.width : spreadView.sideStageWidth
285− color: "#44FF0000"
286− x: spreadView.width // - units.gu(10) // just to see 'em
314+ x: spreadView.width
287−
315+ z: spreadView.indexToZIndex(index)
288− // We need to shuffle z ordering a bit in order to keep side stage apps above main stage apps.
316+
289− // We don't want to really reorder them in the model because that allows us to keep track
317+ onWidthChanged: print("width changed!", width)
290− // of the last focused order.
318+
291− z: {
319+ active: model.appId == priv.mainStageAppId || model.appId == priv.sideStageAppId
292− if (spreadTile.active && model.stage == ApplicationInfoInterface.MainStage) return 0;
320+ zIndex: z
293− if (spreadTile.active && model.stage == ApplicationInfoInterface.SideStage) {
321+ selected: spreadView.selectedIndex == index
294− if (spreadView.nextInStack >= 0 && ApplicationManager.get(spreadView.nextInStack).stage == ApplicationInfoInterface.MainStage) {
322+ otherSelected: spreadView.selectedIndex >= 0 && !selected
295− return Math.max(index, 2);
323+ isInSideStage: priv.sideStageAppId == model.appId
296− } else {
324+ interactive: !spreadView.interactive
297− return 1;
325+
298− }
326+ progress: {
299− }
327+ var tileProgress = (spreadView.contentX - zIndex * spreadView.tileDistance) / spreadView.width;
300− if (index <= 2 && model.stage == ApplicationInfoInterface.MainStage && priv.sideStageAppId) {
328+ // Some tiles (nextInStack, active) need to move directly from the beginning, normalize progress to immediately start at 0
301− return priv.indexOf(priv.sideStageAppId) < index ? index - 1 : index;
329+ if ((index == spreadView.nextInStack && spreadView.phase < 2) || (active && spreadView.phase < 1)) {
330+ tileProgress += zIndex * spreadView.tileDistance / spreadView.width;
302 }
331 }
303− if (index == spreadView.nextInStack && model.stage == ApplicationInfoInterface.SideStage) {
304− if (priv.sideStageAppId) {
305− return 2;
332+ return tileProgress;
306− }
307− return 1;
308− }
309− return index;
310 }
333 }
311
334
312− TransformedTabletSpreadDelegate {
335+ animatedProgress: {
313− id: spreadTile
336+ if (spreadView.phase == 0 && (spreadTile.active || spreadView.nextInStack == index)) {
314− height: spreadView.height
315− width: model.stage == ApplicationInfoInterface.MainStage ? spreadView.width : spreadView.sideStageWidth
316−// opacity: .3
317−
318− onWidthChanged: print("width changed!", width)
319−
320− active: model.appId == priv.mainStageAppId || model.appId == priv.sideStageAppId
321− zIndex: parent.z
322− selected: spreadView.selectedIndex == index
323− otherSelected: spreadView.selectedIndex >= 0 && !selected
324− isInSideStage: priv.sideStageAppId == model.appId
325− interactive: !spreadView.interactive
326−
327− progress: {
328− var tileProgress = (spreadView.contentX - zIndex * spreadView.tileDistance) / spreadView.width;
329− // The Tile which is next in the stack needs to move directly from the beginning...
330−// print("tile0Progress is", tileProgress, "next", spreadView.nextInStack, zIndex, "PHASE:", spreadView.phase)
331− if (index == spreadView.nextInStack && spreadView.phase < 2) {
332−// print("üüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüü")
333− tileProgress += zIndex * spreadView.tileDistance / spreadView.width;
334− }
335− return tileProgress;
336− }
337−
338− animatedProgress: {
339−// print("PHASE:", spreadView.phase)
340− if (spreadView.phase == 0 && (active || spreadView.nextInStack == index)) {
341− if (progress < spreadView.positionMarker1) {
337+ if (progress < spreadView.positionMarker1) {
342−// print("progress is", progress, "index", zIndex, "appid", model.appId)
343− return progress;
338+ return progress;
344− } else if (progress < spreadView.positionMarker1 + snappingCurve.period){
339+ } else if (progress < spreadView.positionMarker1 + snappingCurve.period){
345−// print("progress is", progress, "index", zIndex, "appid", model.appId)
346− return spreadView.positionMarker1 + snappingCurve.value * 3;
340+ return spreadView.positionMarker1 + snappingCurve.value * 3;
347− } else {
341+ } else {
348−// print("progress is", progress, "index", zIndex, "appid", model.appId)
349− return spreadView.positionMarker2;
342+ return spreadView.positionMarker2;
350− }
351 }
343 }
352−// print("progress is", progress, "index", zIndex, "appid", model.appId)
353− return progress;
354 }
344 }
345+ return progress;
346+ }
355
347
356− onClicked: {
348+ onClicked: {
357− if (spreadView.phase == 2) {
349+ if (spreadView.phase == 2) {
358− if (ApplicationManager.focusedApplicationId == ApplicationManager.get(index).appId) {
350+ if (ApplicationManager.focusedApplicationId == ApplicationManager.get(index).appId) {
359− spreadView.snapTo(index);
351+ spreadView.snapTo(index);
360− } else {
352+ } else {
361− ApplicationManager.requestFocusApplication(ApplicationManager.get(index).appId);
353+ ApplicationManager.requestFocusApplication(ApplicationManager.get(index).appId);
362− }
363 }
354 }
364 }
355 }
356+ }
365
357
366− EasingCurve {
358+ EasingCurve {
367− id: snappingCurve
359+ id: snappingCurve
368− type: EasingCurve.Linear
360+ type: EasingCurve.Linear
369− period: (spreadView.positionMarker2 - spreadView.positionMarker1) / 3
361+ period: (spreadView.positionMarker2 - spreadView.positionMarker1) / 3
370− progress: spreadTile.progress - spreadView.positionMarker1
362+ progress: spreadTile.progress - spreadView.positionMarker1
371− }
372−
373−// Rectangle {
374−// anchors.fill: parent; color: "#FF00FF"
375−// border.width: units.gu(1)
376−// border.color: "black"
377−// Label {
378−// anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: units.gu(2) }
379−// fontSize: "x-large"
380−// text: spreadTile.zIndex + "/" + model.index
381−// }
382−// }
383 }
363 }
384 }
364 }
385 }
365 }
qml/Stages/TransformedTabletSpreadDelegate.qml+9−3
@@ -78,7 +78,8 @@ SpreadDelegate {
78 Item {
78 Item {
79 id: priv
79 id: priv
80
80
81− property bool nextInStack: spreadView.nextInStack == index;
81+ property bool nextInStack: spreadView.nextZInStack == zIndex
82+ property bool movedActive: spreadView.nextZInStack == zIndex + 1
82 property real animatedEndDistance: linearAnimation(0, 2, root.endDistance, 0, root.progress)
83 property real animatedEndDistance: linearAnimation(0, 2, root.endDistance, 0, root.progress)
83
84
84 property real phase2StartTranslate
85 property real phase2StartTranslate
@@ -108,7 +109,7 @@ SpreadDelegate {
108 // the progress for each tile starts at 0 when it crosses the right edge, so the later a tile comes in,
109 // the progress for each tile starts at 0 when it crosses the right edge, so the later a tile comes in,
109 // the bigger its negativeProgress can be.
110 // the bigger its negativeProgress can be.
110 property real negativeProgress: {
111 property real negativeProgress: {
111− if (index == spreadView.nextInStack && spreadView.phase < 2) {
112+ if (nextInStack && spreadView.phase < 2) {
112 return 0;
113 return 0;
113 }
114 }
114 return -root.zIndex * spreadView.tileDistance / spreadView.width;
115 return -root.zIndex * spreadView.tileDistance / spreadView.width;
@@ -143,6 +144,10 @@ SpreadDelegate {
143
144
144 if (active) {
145 if (active) {
145 newTranslate -= root.width
146 newTranslate -= root.width
147+// print("nextZ", spreadView.nextZInStack, "this z", root.zIndex, index, root.animatedProgress)
148+ if (spreadView.phase == 0 && priv.movedActive) {
149+ newTranslate += linearAnimation(0, spreadView.positionMarker2, 0, -units.gu(4), root.animatedProgress)
150+ }
146 }
151 }
147 if (nextInStack && spreadView.phase == 0) {
152 if (nextInStack && spreadView.phase == 0) {
148 if (model.stage == ApplicationInfoInterface.MainStage) {
153 if (model.stage == ApplicationInfoInterface.MainStage) {
@@ -177,7 +182,8 @@ SpreadDelegate {
177 } else if (root.active) {
182 } else if (root.active) {
178 var startProgress = spreadView.positionMarker2 - (zIndex * spreadView.positionMarker2 / 2)
183 var startProgress = spreadView.positionMarker2 - (zIndex * spreadView.positionMarker2 / 2)
179 var endProgress = spreadView.positionMarker4 - (zIndex * spreadView.tileDistance / spreadView.width)
184 var endProgress = spreadView.positionMarker4 - (zIndex * spreadView.tileDistance / spreadView.width)
185+ var startTranslate = -root.width + (priv.movedActive ? -units.gu(4) : 0)
180− newTranslate = linearAnimation(startProgress, endProgress, -root.width, priv.phase2StartTranslate, root.progress);
186+ newTranslate = linearAnimation(startProgress, endProgress, startTranslate, priv.phase2StartTranslate, root.progress);
181 } else {
187 } else {
182 var startProgress = spreadView.positionMarker2 - (zIndex * spreadView.positionMarker2 / 2)
188 var startProgress = spreadView.positionMarker2 - (zIndex * spreadView.positionMarker2 / 2)
183 var endProgress = spreadView.positionMarker4 - (zIndex * spreadView.tileDistance / spreadView.width)
189 var endProgress = spreadView.positionMarker4 - (zIndex * spreadView.tileDistance / spreadView.width)