~ci-train-bot/unity8/unity8-ubuntu-zesty-2320

« back to all changes in this revision

Viewing changes to qml/Stage/Stage.qml

  • Committer: Bileto Bot
  • Author(s): Michael Zanetti
  • Date: 2017-02-16 13:44:15 UTC
  • mfrom: (2798.2.1 unity8-fix-spread-jump)
  • Revision ID: ci-train-bot@canonical.com-20170216134415-cyhdvyke7wcwel68
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

Show diffs side-by-side

added added

removed removed

Lines of Context:
506
506
        Transition {
507
507
            to: "spread"
508
508
            PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
509
 
            PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
510
509
        },
511
510
        Transition {
512
511
            from: "spread"
521
520
                    }
522
521
                }
523
522
                PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
 
523
                PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
524
524
            }
525
525
        },
526
526
        Transition {
1850
1850
            var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1851
1851
            if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1852
1852
                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);
1854
1854
                snapAnimation.start();
1855
1855
            } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1856
1856
                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);
1858
1858
                snapAnimation.start();
1859
1859
            }
1860
1860
        }