@@ -47,6 +47,7 @@ FocusScope {
4747 property bool oskEnabled: false
4848 property rect inputMethodRect
4949 property real rightEdgePushProgress: 0
50+ property PanelState panelState
5051
5152 // Configuration
5253 property string mode: "staged"
@@ -349,23 +350,23 @@ FocusScope {
349350 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
350351 }
351352
352− Component.onCompleted: priv.updateMainAndSideStageIndexes();
353+ Component.onCompleted: priv.updateMainAndSideStageIndexes()
353354
354355 Connections {
355− target: PanelState
356+ target: panelState
356357 onCloseClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.close(); } }
357358 onMinimizeClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestMinimize(); } }
358359 onRestoreClicked: { if (priv.focusedAppDelegate) { priv.focusedAppDelegate.requestRestore(); } }
359360 }
360361
361362 Binding {
362− target: PanelState
363+ target: panelState
363364 property: "decorationsVisible"
364365 value: priv.focusedAppDelegate !== null && priv.focusedAppDelegate.maximized // FIXME for Locally integrated menus
365366 }
366367
367368 Binding {
368− target: PanelState
369+ target: panelState
369370 property: "title"
370371 value: {
371372 if (priv.focusedAppDelegate !== null) {
@@ -380,7 +381,7 @@ FocusScope {
380381 }
381382
382383 Binding {
383− target: PanelState
384+ target: panelState
384385 property: "focusedPersistentSurfaceId"
385386 value: {
386387 if (priv.focusedAppDelegate !== null) {
@@ -394,21 +395,21 @@ FocusScope {
394395 }
395396
396397 Binding {
397− target: PanelState
398+ target: panelState
398399 property: "dropShadow"
399400 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null && mode == "windowed"
400401 }
401402
402403 Binding {
403− target: PanelState
404+ target: panelState
404405 property: "closeButtonShown"
405406 value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && !priv.focusedAppDelegate.isDash
406407 }
407408
408409 Component.onDestruction: {
409− PanelState.title = "";
410− PanelState.decorationsVisible = false;
411− PanelState.dropShadow = false;
410+ panelState.title = "";
411+ panelState.decorationsVisible = false;
412+ panelState.dropShadow = false;
412413 }
413414
414415 Instantiator {
@@ -454,6 +455,7 @@ FocusScope {
454455 PropertyChanges { target: cancelSpreadMouseArea; enabled: true }
455456 PropertyChanges { target: blurLayer; visible: true; blurRadius: 32; brightness: .65; opacity: 1 }
456457 PropertyChanges { target: wallpaper; visible: false }
458+ PropertyChanges { target: screensAndWorkspaces; opacity: 1 }
457459 },
458460 State {
459461 name: "stagedRightEdge"; when: root.spreadEnabled && (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
@@ -502,10 +504,13 @@ FocusScope {
502504 from: "stagedRightEdge,sideStagedRightEdge,windowedRightEdge"; to: "spread"
503505 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
504506 PropertyAnimation { target: blurLayer; properties: "brightness,blurRadius"; duration: priv.animationDuration }
507+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
505508 },
506509 Transition {
507510 to: "spread"
508511 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: appRepeater.count > 1 ? 1 : 0 }
512+ PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
513+ UbuntuNumberAnimation { target: screensAndWorkspaces; property: "opacity"; duration: priv.animationDuration }
509514 },
510515 Transition {
511516 from: "spread"
@@ -563,10 +568,21 @@ FocusScope {
563568 visible: false
564569 }
565570
571+ ScreensAndWorkspaces {
572+ id: screensAndWorkspaces
573+ anchors { left: parent.left; top: parent.top; right: parent.right; leftMargin: root.leftMargin }
574+ height: Math.max(units.gu(30), parent.height * .3)
575+ background: root.background
576+ opacity: 0
577+ visible: opacity > 0
578+
579+ onCloseSpread: priv.goneToSpread = false;
580+ }
581+
566582 Spread {
567583 id: spreadItem
568584 objectName: "spreadItem"
569− anchors.fill: appContainer
585+ anchors { left: parent.left; bottom: parent.bottom; right: parent.right; top: screensAndWorkspaces.bottom }
570586 leftMargin: root.leftMargin
571587 model: root.topLevelSurfaceList
572588 spreadFlickable: floatingFlickable
@@ -575,6 +591,83 @@ FocusScope {
575591 onLeaveSpread: {
576592 priv.goneToSpread = false;
577593 }
594+
595+ FloatingFlickable {
596+ id: floatingFlickable
597+ objectName: "spreadFlickable"
598+ anchors.fill: parent
599+ enabled: false
600+ contentWidth: spreadItem.spreadTotalWidth
601+
602+ function snap(toIndex) {
603+ var delegate = appRepeater.itemAt(toIndex)
604+ var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
605+ if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
606+ var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
607+ snapAnimation.to = floatingFlickable.contentX - offset;
608+ snapAnimation.start();
609+ } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
610+ var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
611+ snapAnimation.to = floatingFlickable.contentX - offset;
612+ snapAnimation.start();
613+ }
614+ }
615+ UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
616+ }
617+
618+ MouseArea {
619+ id: hoverMouseArea
620+ objectName: "hoverMouseArea"
621+ anchors.fill: parent
622+ propagateComposedEvents: true
623+ hoverEnabled: true
624+ enabled: false
625+ visible: enabled
626+
627+ property int scrollAreaWidth: width / 3
628+ property bool progressiveScrollingEnabled: false
629+
630+ onPressed: mouse.accepted = false
631+
632+ onMouseXChanged: {
633+ mouse.accepted = false
634+
635+ if (hoverMouseArea.pressed) {
636+ return;
637+ }
638+
639+ // Find the hovered item and mark it active
640+ for (var i = appRepeater.count - 1; i >= 0; i--) {
641+ var appDelegate = appRepeater.itemAt(i);
642+ var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
643+ var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
644+ if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
645+ spreadItem.highlightedIndex = i;
646+ break;
647+ }
648+ }
649+
650+ if (floatingFlickable.contentWidth > floatingFlickable.width) {
651+ var margins = floatingFlickable.width * 0.05;
652+
653+ if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
654+ progressiveScrollingEnabled = true
655+ }
656+
657+ // do we need to scroll?
658+ if (mouseX < scrollAreaWidth + margins) {
659+ var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
660+ var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
661+ floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
662+ }
663+ if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
664+ var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
665+ var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
666+ floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
667+ }
668+ }
669+ }
670+ }
578671 }
579672
580673 Connections {
@@ -669,10 +762,28 @@ FocusScope {
669762 }
670763 }
671764
765+ MirSurfaceItem {
766+ id: fakeDragItem
767+ property real previewScale: .5
768+ height: (screensAndWorkspaces.height - units.gu(8)) / 2
769+ // w : h = iw : ih
770+ width: implicitWidth * height / implicitHeight
771+ surfaceWidth: -1
772+ surfaceHeight: -1
773+ opacity: surface != null ? 1 : 0
774+ Behavior on opacity { UbuntuNumberAnimation {} }
775+ visible: opacity > 0
776+
777+ Drag.active: surface != null
778+ Drag.keys: ["application"]
779+
780+ z: 1000
781+ }
782+
672783 Item {
673784 id: boundariesForWindowPlacement
674785 anchors.fill: parent
675− anchors.topMargin: PanelState.panelHeight
786+ anchors.topMargin: panelState.panelHeight
676787 visible: false
677788 }
678789
@@ -704,6 +815,9 @@ FocusScope {
704815 }
705816 z: normalZ
706817
818+ opacity: fakeDragItem.surface == model.window.surface && fakeDragItem.Drag.active ? 0 : 1
819+ Behavior on opacity { UbuntuNumberAnimation {} }
820+
707821 // Normally we want x/y where the surface thinks it is. Width/height of our delegate will
708822 // match what the actual surface size is.
709823 // Don't write to those, they will be set by states
@@ -765,7 +879,7 @@ FocusScope {
765879 target: appDelegate
766880 property: "y"
767881 value: appDelegate.requestedY -
768− Math.min(appDelegate.requestedY - PanelState.panelHeight,
882+ Math.min(appDelegate.requestedY - panelState.panelHeight,
769883 Math.max(0, priv.virtualKeyboardHeight - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
770884 when: root.oskEnabled && appDelegate.focus && (appDelegate.state == "normal" || appDelegate.state == "restored")
771885 && root.inputMethodRect.height > 0
@@ -876,7 +990,6 @@ FocusScope {
876990 function claimFocus() {
877991 if (root.state == "spread") {
878992 spreadItem.highlightedIndex = index
879− priv.goneToSpread = false;
880993 }
881994 if (root.mode == "stagedWithSideStage") {
882995 if (appDelegate.stage == ApplicationInfoInterface.SideStage && !sideStage.shown) {
@@ -1163,7 +1276,7 @@ FocusScope {
11631276 progress: 0
11641277 targetHeight: spreadItem.stackHeight
11651278 targetX: spreadMaths.targetX
1166− startY: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1279+ startY: appDelegate.fullscreen ? 0 : panelState.panelHeight
11671280 targetY: spreadMaths.targetY
11681281 targetAngle: spreadMaths.targetAngle
11691282 targetScale: spreadMaths.targetScale
@@ -1209,8 +1322,6 @@ FocusScope {
12091322 y: spreadMaths.targetY
12101323 z: index
12111324 height: spreadItem.spreadItemHeight
1212− requestedWidth: decoratedWindow.oldRequestedWidth
1213− requestedHeight: decoratedWindow.oldRequestedHeight
12141325 visible: spreadMaths.itemVisible
12151326 }
12161327 PropertyChanges { target: dragArea; enabled: true }
@@ -1230,8 +1341,6 @@ FocusScope {
12301341 y: stagedRightEdgeMaths.animatedY
12311342 z: stagedRightEdgeMaths.animatedZ
12321343 height: stagedRightEdgeMaths.animatedHeight
1233− requestedWidth: decoratedWindow.oldRequestedWidth
1234− requestedHeight: decoratedWindow.oldRequestedHeight
12351344 visible: appDelegate.x < root.width
12361345 }
12371346 PropertyChanges {
@@ -1261,8 +1370,6 @@ FocusScope {
12611370 y: windowedRightEdgeMaths.animatedY
12621371 z: windowedRightEdgeMaths.animatedZ
12631372 height: stagedRightEdgeMaths.animatedHeight
1264− requestedWidth: decoratedWindow.oldRequestedWidth
1265− requestedHeight: decoratedWindow.oldRequestedHeight
12661373 }
12671374 PropertyChanges {
12681375 target: decoratedWindow
@@ -1284,12 +1391,16 @@ FocusScope {
12841391 PropertyChanges {
12851392 target: appDelegate
12861393 x: stageMaths.itemX
1287− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1288− requestedWidth: appContainer.width
1289− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
1394+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
12901395 visuallyMaximized: true
12911396 visible: appDelegate.x < root.width
12921397 }
1398+ PropertyChanges {
1399+ target: appDelegate
1400+ requestedWidth: appContainer.width
1401+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1402+ restoreEntryValues: false
1403+ }
12931404 PropertyChanges {
12941405 target: decoratedWindow
12951406 hasDecoration: false
@@ -1312,13 +1423,17 @@ FocusScope {
13121423 PropertyChanges {
13131424 target: appDelegate
13141425 x: stageMaths.itemX
1315− y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
1426+ y: appDelegate.fullscreen ? 0 : panelState.panelHeight
13161427 z: stageMaths.itemZ
1317− requestedWidth: stageMaths.itemWidth
1318− requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
13191428 visuallyMaximized: true
13201429 visible: appDelegate.x < root.width
13211430 }
1431+ PropertyChanges {
1432+ target: appDelegate
1433+ requestedWidth: stageMaths.itemWidth
1434+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - panelState.panelHeight
1435+ restoreEntryValues: false
1436+ }
13221437 PropertyChanges {
13231438 target: decoratedWindow
13241439 hasDecoration: false
@@ -1336,8 +1451,12 @@ FocusScope {
13361451 requestedY: 0;
13371452 visuallyMinimized: false;
13381453 visuallyMaximized: true
1339− requestedWidth: appContainer.width - root.leftMargin;
1340− requestedHeight: appContainer.height;
1454+ }
1455+ PropertyChanges {
1456+ target: appDelegate
1457+ requestedWidth: appContainer.width - root.leftMargin
1458+ requestedHeight: appContainer.height
1459+ restoreEntryValues: false
13411460 }
13421461 PropertyChanges { target: touchControls; enabled: true }
13431462 },
@@ -1347,8 +1466,12 @@ FocusScope {
13471466 target: appDelegate;
13481467 requestedX: 0
13491468 requestedY: 0
1350− requestedWidth: appContainer.width;
1351− requestedHeight: appContainer.height;
1469+ }
1470+ PropertyChanges {
1471+ target: appDelegate
1472+ requestedWidth: appContainer.width
1473+ requestedHeight: appContainer.height
1474+ restoreEntryValues: false
13521475 }
13531476 PropertyChanges { target: decoratedWindow; hasDecoration: false }
13541477 },
@@ -1363,6 +1486,12 @@ FocusScope {
13631486 PropertyChanges { target: touchControls; enabled: true }
13641487 PropertyChanges { target: resizeArea; enabled: true }
13651488 PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
1489+ PropertyChanges {
1490+ target: appDelegate
1491+ requestedWidth: windowedWidth
1492+ requestedHeight: windowedHeight
1493+ restoreEntryValues: false
1494+ }
13661495 },
13671496 State {
13681497 name: "restored";
@@ -1380,9 +1509,9 @@ FocusScope {
13801509 PropertyChanges {
13811510 target: appDelegate
13821511 windowedX: root.leftMargin
1383− windowedY: PanelState.panelHeight
1512+ windowedY: panelState.panelHeight
13841513 windowedWidth: (appContainer.width - root.leftMargin)/2
1385− windowedHeight: appContainer.height - PanelState.panelHeight
1514+ windowedHeight: appContainer.height - panelState.panelHeight
13861515 }
13871516 },
13881517 State {
@@ -1399,9 +1528,9 @@ FocusScope {
13991528 PropertyChanges {
14001529 target: appDelegate
14011530 windowedX: root.leftMargin
1402− windowedY: PanelState.panelHeight
1531+ windowedY: panelState.panelHeight
14031532 windowedWidth: (appContainer.width - root.leftMargin)/2
1404− windowedHeight: (appContainer.height - PanelState.panelHeight)/2
1533+ windowedHeight: (appContainer.height - panelState.panelHeight)/2
14051534 }
14061535 },
14071536 State {
@@ -1418,7 +1547,7 @@ FocusScope {
14181547 PropertyChanges {
14191548 target: appDelegate
14201549 windowedX: root.leftMargin
1421− windowedY: (appContainer.height + PanelState.panelHeight)/2
1550+ windowedY: (appContainer.height + panelState.panelHeight)/2
14221551 windowedWidth: (appContainer.width - root.leftMargin)/2
14231552 windowedHeight: appContainer.height/2
14241553 }
@@ -1440,8 +1569,8 @@ FocusScope {
14401569 State {
14411570 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
14421571 extend: "normal"
1443− PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: PanelState.panelHeight;
1444− windowedWidth: windowedWidth; windowedHeight: appContainer.height - PanelState.panelHeight }
1572+ PropertyChanges { target: appDelegate; windowedX: windowedX; windowedY: panelState.panelHeight;
1573+ windowedWidth: windowedWidth; windowedHeight: appContainer.height - panelState.panelHeight }
14451574 },
14461575 State {
14471576 name: "minimized"; when: appDelegate.minimized
@@ -1456,6 +1585,10 @@ FocusScope {
14561585 }
14571586 }
14581587 ]
1588+ onStateChanged: {
1589+ print("item", index, "state changed", state)
1590+ }
1591+
14591592 transitions: [
14601593 Transition {
14611594 from: "staged,stagedWithSideStage"
@@ -1469,6 +1602,7 @@ FocusScope {
14691602 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedX,requestedY,requestedWidth,requestedHeight"; duration: priv.animationDuration}
14701603 },
14711604 Transition {
1605+ from: "normal,restored,maximized,maximizedHorizontally,maximizedVertically,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedBottomLeft,maximizedTopRight,maximizedBottomRight,staged,stagedWithSideStage,windowedRightEdge,stagedRightEdge";
14721606 to: "spread"
14731607 // DecoratedWindow wants the scaleToPreviewSize set before enabling scaleToPreview
14741608 PropertyAction { target: appDelegate; properties: "z,visible" }
@@ -1554,7 +1688,7 @@ FocusScope {
15541688 ]
15551689
15561690 Binding {
1557− target: PanelState
1691+ target: panelState
15581692 property: "decorationsAlwaysVisible"
15591693 value: appDelegate && appDelegate.maximized && touchControls.overlayShown
15601694 }
@@ -1575,6 +1709,7 @@ FocusScope {
15751709 borderThickness: units.gu(2)
15761710 enabled: false
15771711 visible: enabled
1712+ readyToAssesBounds: !appDelegate._constructing
15781713
15791714 onPressed: {
15801715 appDelegate.activate();
@@ -1602,12 +1737,6 @@ FocusScope {
16021737 requestedWidth: appDelegate.requestedWidth
16031738 requestedHeight: appDelegate.requestedHeight
16041739
1605− property int oldRequestedWidth: -1
1606− property int oldRequestedHeight: -1
1607−
1608− onRequestedWidthChanged: oldRequestedWidth = requestedWidth
1609− onRequestedHeightChanged: oldRequestedHeight = requestedHeight
1610−
16111740 onCloseClicked: { appDelegate.close(); }
16121741 onMaximizeClicked: {
16131742 if (appDelegate.canBeMaximized) {
@@ -1730,12 +1859,15 @@ FocusScope {
17301859 objectName: "closeMouseArea"
17311860 anchors { left: parent.left; top: parent.top; leftMargin: -height / 2; topMargin: -height / 2 + spreadMaths.closeIconOffset }
17321861 readonly property var mousePos: hoverMouseArea.mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1733− visible: !appDelegate.isDash && dragArea.distance == 0
1862+ readonly property bool shown: !appDelegate.isDash && dragArea.distance == 0
17341863 && index == spreadItem.highlightedIndex
17351864 && mousePos.y < (decoratedWindow.height / 3)
17361865 && mousePos.y > -units.gu(4)
17371866 && mousePos.x > -units.gu(4)
17381867 && mousePos.x < (decoratedWindow.width * 2 / 3)
1868+ opacity: shown ? 1 : 0
1869+ visible: opacity > 0
1870+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
17391871 height: units.gu(6)
17401872 width: height
17411873
@@ -1797,83 +1929,7 @@ FocusScope {
17971929 leftMargin: root.leftMargin
17981930 appContainerWidth: appContainer.width
17991931 appContainerHeight: appContainer.height
1800− }
1801−
1802− MouseArea {
1803− id: hoverMouseArea
1804− objectName: "hoverMouseArea"
1805− anchors.fill: appContainer
1806− propagateComposedEvents: true
1807− hoverEnabled: true
1808− enabled: false
1809− visible: enabled
1810−
1811− property int scrollAreaWidth: width / 3
1812− property bool progressiveScrollingEnabled: false
1813−
1814− onMouseXChanged: {
1815− mouse.accepted = false
1816−
1817− if (hoverMouseArea.pressed) {
1818− return;
1819− }
1820−
1821− // Find the hovered item and mark it active
1822− for (var i = appRepeater.count - 1; i >= 0; i--) {
1823− var appDelegate = appRepeater.itemAt(i);
1824− var mapped = mapToItem(appDelegate, hoverMouseArea.mouseX, hoverMouseArea.mouseY)
1825− var itemUnder = appDelegate.childAt(mapped.x, mapped.y);
1826− if (itemUnder && (itemUnder.objectName === "dragArea" || itemUnder.objectName === "windowInfoItem" || itemUnder.objectName == "closeMouseArea")) {
1827− spreadItem.highlightedIndex = i;
1828− break;
1829− }
1830− }
1831−
1832− if (floatingFlickable.contentWidth > floatingFlickable.width) {
1833− var margins = floatingFlickable.width * 0.05;
1834−
1835− if (!progressiveScrollingEnabled && mouseX < floatingFlickable.width - scrollAreaWidth) {
1836− progressiveScrollingEnabled = true
1837− }
1838−
1839− // do we need to scroll?
1840− if (mouseX < scrollAreaWidth + margins) {
1841− var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
1842− var contentX = (1 - progress) * (floatingFlickable.contentWidth - floatingFlickable.width)
1843− floatingFlickable.contentX = Math.max(0, Math.min(floatingFlickable.contentX, contentX))
1844− }
1845− if (mouseX > floatingFlickable.width - scrollAreaWidth && progressiveScrollingEnabled) {
1846− var progress = Math.min(1, (mouseX - (floatingFlickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
1847− var contentX = progress * (floatingFlickable.contentWidth - floatingFlickable.width)
1848− floatingFlickable.contentX = Math.min(floatingFlickable.contentWidth - floatingFlickable.width, Math.max(floatingFlickable.contentX, contentX))
1849− }
1850− }
1851− }
1852−
1853− onPressed: mouse.accepted = false
1854− }
1855−
1856− FloatingFlickable {
1857− id: floatingFlickable
1858− objectName: "spreadFlickable"
1859− anchors.fill: appContainer
1860− enabled: false
1861− contentWidth: spreadItem.spreadTotalWidth
1862−
1863− function snap(toIndex) {
1864− var delegate = appRepeater.itemAt(toIndex)
1865− var targetContentX = floatingFlickable.contentWidth / spreadItem.totalItemCount * toIndex;
1866− if (targetContentX - floatingFlickable.contentX > spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) {
1867− var offset = (spreadItem.rightStackXPos - (spreadItem.spreadItemWidth / 2)) - (targetContentX - floatingFlickable.contentX)
1868− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1869− snapAnimation.start();
1870− } else if (targetContentX - floatingFlickable.contentX < spreadItem.leftStackXPos + units.gu(1)) {
1871− var offset = (spreadItem.leftStackXPos + units.gu(1)) - (targetContentX - floatingFlickable.contentX);
1872− snapAnimation.to = Math.max(0, floatingFlickable.contentX - offset);
1873− snapAnimation.start();
1874− }
1875− }
1876− UbuntuNumberAnimation {id: snapAnimation; target: floatingFlickable; property: "contentX"}
1932+ panelState: root.panelState
18771933 }
18781934
18791935 PropertyAnimation {