on xenial help sign in
fix some glitches with spread positioning

There are some circumstances which can cause the spread to jump around * If there are only 2 apps and alt+tab is used to open the spread, move to the first (currently focused one), then release, the next time the spread is invoked, tiles animated to the old position and then jumped to the initial position. Resetting the spread position when the spread is left, fixes that. * If many apps are open and the first one is tabbed to, the flickable could be moved to negative content positions which again would cause a jump when then interacting with the finger or mouse to reposition the spread. Approved by: Lukáš Tinkl, Unity8 CI Bot

commit6c6f59ae88928cb0e78897f586d4f714f83210ad authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 16 Feb 2017, 13:44 (10 years ago) parenta37e4353f45bce
1 file changed+3−3
qml/Stage/Stage.qml+3−3
qml/Stage/Stage.qml+3−3
@@ -506,7 +506,6 @@ FocusScope {
506506 Transition {
507507 to: "spread"
508508 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
509− PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
510509 },
511510 Transition {
512511 from: "spread"
@@ -521,6 +520,7 @@ FocusScope {
521520 }
522521 }
523522 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
523+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
524524 }
525525 },
526526 Transition {
@@ -1850,11 +1850,11 @@ FocusScope {
18501850 var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
18511851 if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
18521852 var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1853− snapAnimation.to = floatingFlickable.contentX - offset;
1853+ snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
18541854 snapAnimation.start();
18551855 } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
18561856 var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1857− snapAnimation.to = floatingFlickable.contentX - offset;
1857+ snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
18581858 snapAnimation.start();
18591859 }
18601860 }