@@ -30,11 +30,10 @@ Item {
30 property bool interactive
30 property bool interactive
32 // State information propagated to the outside
32 // State information propagated to the outside
33− property bool fullscreen: priv.focusedApplication ? priv.focusedApplication.fullscreen : false
34− property bool locked: spreadView.phase == 2
33+ readonly property bool locked: spreadView.phase == 2
36 function select(appId) {
35 function select(appId) {
37− spreadView.snapTo(priv.indexOf(appId))
36+ spreadView.snapTo(priv.indexOf(appId));
40 onWidthChanged: {
39 onWidthChanged: {
@@ -54,21 +53,13 @@ Item {
57− onFocusedApplicationIdChanged: {
58− if (ApplicationManager.focusedApplicationId.length > 0) {
59− var application = priv.focusedApplication;
60− root.fullscreen = application.fullscreen;
61− var appIndex = priv.indexOf(application.appId);
65 onApplicationAdded: {
56 onApplicationAdded: {
66 if (spreadView.phase == 2) {
57 if (spreadView.phase == 2) {
67 spreadView.snapTo(ApplicationManager.count - 1);
58 spreadView.snapTo(ApplicationManager.count - 1);
69 spreadView.phase = 0;
60 spreadView.phase = 0;
70− spreadView.contentX = -spreadView.shift
61+ spreadView.contentX = -spreadView.shift;
71− priv.switchToApp(appId)
62+ priv.switchToApp(appId);
@@ -90,8 +81,7 @@ Item {
91 function switchToApp(appId) {
82 function switchToApp(appId) {
92 if (priv.focusedAppId) {
83 if (priv.focusedAppId) {
93− root.fullscreen = ApplicationManager.findApplication(appId).fullscreen;
94− spreadView.focusChanging = true
84+ spreadView.focusChanging = true;
95 ApplicationManager.focusApplication(appId);
85 ApplicationManager.focusApplication(appId);
97 ApplicationManager.focusApplication(appId);
87 ApplicationManager.focusApplication(appId);
@@ -182,9 +172,9 @@ Item {
182 snapAnimation.targetContentX = -shift;
172 snapAnimation.targetContentX = -shift;
183 snapAnimation.start();
173 snapAnimation.start();
184 } else if (shiftedContentX < positionMarker2 * width) {
174 } else if (shiftedContentX < positionMarker2 * width) {
185− snapTo(1)
175+ snapTo(1);
186 } else if (shiftedContentX < positionMarker3 * width) {
176 } else if (shiftedContentX < positionMarker3 * width) {
187− snapTo(1)
177+ snapTo(1);
188 } else if (phase < 2){
178 } else if (phase < 2){
189 // Add 1 pixel to make sure we definitely hit positionMarker4 even with rounding errors of the animation.
179 // Add 1 pixel to make sure we definitely hit positionMarker4 even with rounding errors of the animation.
190 snapAnimation.targetContentX = width * positionMarker4 + 1 - shift;
180 snapAnimation.targetContentX = width * positionMarker4 + 1 - shift;
@@ -197,7 +187,6 @@ Item {
197 index = 0;
187 index = 0;
199 spreadView.selectedIndex = index;
189 spreadView.selectedIndex = index;
200− root.fullscreen = ApplicationManager.get(index).fullscreen;
201 // If we're not in full spread mode yet, always unwind to start pos
190 // If we're not in full spread mode yet, always unwind to start pos
202 // otherwise unwind up to progress 0 of the selected index
191 // otherwise unwind up to progress 0 of the selected index
203 if (spreadView.phase < 2) {
192 if (spreadView.phase < 2) {
@@ -224,7 +213,7 @@ Item {
224 if (spreadView.selectedIndex >= 0) {
213 if (spreadView.selectedIndex >= 0) {
225 ApplicationManager.focusApplication(ApplicationManager.get(spreadView.selectedIndex).appId);
214 ApplicationManager.focusApplication(ApplicationManager.get(spreadView.selectedIndex).appId);
227− spreadView.selectedIndex = -1
216+ spreadView.selectedIndex = -1;
228 spreadView.phase = 0;
217 spreadView.phase = 0;
229 spreadView.contentX = -spreadView.shift;
218 spreadView.contentX = -spreadView.shift;
@@ -244,7 +233,7 @@ Item {
245 onWidthChanged: {
234 onWidthChanged: {
246 if (spreadView.closingIndex >= 0) {
235 if (spreadView.closingIndex >= 0) {
247− spreadView.contentX = Math.min(spreadView.contentX, width - spreadView.width - spreadView.shift)
236+ spreadView.contentX = Math.min(spreadView.contentX, width - spreadView.width - spreadView.shift);
@@ -280,7 +269,7 @@ Item {
280 UbuntuNumberAnimation {
269 UbuntuNumberAnimation {
281 onRunningChanged: {
270 onRunningChanged: {
282 if (!running) {
271 if (!running) {
283− spreadView.closingIndex = -1
272+ spreadView.closingIndex = -1;
@@ -292,23 +281,27 @@ Item {
292 duration: UbuntuAnimation.FastDuration
281 duration: UbuntuAnimation.FastDuration
293 onRunningChanged: {
282 onRunningChanged: {
294 if (!running) {
283 if (!running) {
295− spreadView.focusChanging = false
284+ spreadView.focusChanging = false;
301 // Each tile has a different progress value running from 0 to 1.
290 // Each tile has a different progress value running from 0 to 1.
302− // A progress value of 0 means the tile is at the right edge. 1 means the tile has reched the left edge.
291+ // 0: means the tile is at the right edge.
292+ // 1: means the tile has finished the main animation towards the left edge.
293+ // >1: after the main animation has finished, tiles will continue to move very slowly to the left
303 progress: {
294 progress: {
304 var tileProgress = (spreadView.shiftedContentX - behavioredIndex * spreadView.tileDistance) / spreadView.width;
295 var tileProgress = (spreadView.shiftedContentX - behavioredIndex * spreadView.tileDistance) / spreadView.width;
305 // Tile 1 needs to move directly from the beginning...
296 // Tile 1 needs to move directly from the beginning...
306 if (behavioredIndex == 1 && spreadView.phase < 2) {
297 if (behavioredIndex == 1 && spreadView.phase < 2) {
307 tileProgress += spreadView.tileDistance / spreadView.width;
298 tileProgress += spreadView.tileDistance / spreadView.width;
309− // Limiting progress to ~0 and 1.7 to avoid binding calculations when tiles are either
300+ // Limiting progress to ~0 and 1.7 to avoid binding calculations when tiles are not
310− // outside the screen on the right (progress < 0) or hidden by other tiles on the left
302+ // < 0 : The tile is outside the screen on the right
303+ // > 1.7: The tile is *very* close to the left edge and covered by other tiles now.
311− // (> 1.7). Using 0.0001 to differentiate when a tile should still be visible (==0)
304+ // Using 0.0001 to differentiate when a tile should still be visible (==0)
312 // or we can hide it (< 0)
305 // or we can hide it (< 0)
313 tileProgress = Math.max(-0.0001, Math.min(1.7, tileProgress));
306 tileProgress = Math.max(-0.0001, Math.min(1.7, tileProgress));
314 return tileProgress;
307 return tileProgress;
@@ -346,9 +339,9 @@ Item {
348 onClosed: {
341 onClosed: {
349− spreadView.draggedIndex = -1
342+ spreadView.draggedIndex = -1;
350− spreadView.closingIndex = index
343+ spreadView.closingIndex = index;
351− ApplicationManager.stopApplication(ApplicationManager.get(index).appId)
344+ ApplicationManager.stopApplication(ApplicationManager.get(index).appId);
@@ -425,5 +418,4 @@ Item {