@@ -22,6 +22,7 @@ import "../Components"
22import Utils 0.1
22import Utils 0.1
23import Ubuntu.Gestures 0.1
23import Ubuntu.Gestures 0.1
24import GlobalShortcut 1.0
24import GlobalShortcut 1.0
26AbstractStage {
27AbstractStage {
@@ -313,6 +314,12 @@ AbstractStage {
314 onStateChanged: print("spread going to state:", state)
315 onStateChanged: print("spread going to state:", state)
319+ anchors.fill: appContainer
320+ totalItemCount: appRepeater.count
317 FocusScope {
324 FocusScope {
318 id: appContainer
325 id: appContainer
@@ -689,8 +696,8 @@ AbstractStage {
690 SpreadMaths {
697 SpreadMaths {
691 id: spreadMaths
698 id: spreadMaths
692 itemIndex: index
700 itemIndex: index
693− totalItems: appRepeater.count
694 flickable: floatingFlickable
701 flickable: floatingFlickable
696 StageMaths {
703 StageMaths {
@@ -710,8 +717,8 @@ AbstractStage {
710 sceneWidth: appContainer.width - root.leftMargin
717 sceneWidth: appContainer.width - root.leftMargin
711 sceneHeight: appContainer.height
718 sceneHeight: appContainer.height
712 progress: 0
719 progress: 0
713− targetX: spreadMaths.animatedX
720+ targetX: spreadMaths.targetX
714− targetAngle: spreadMaths.animatedAngle
721+ targetAngle: spreadMaths.targetAngle
717// onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
724// onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
@@ -720,21 +727,23 @@ AbstractStage {
720 states: [
727 states: [
722 name: "spread"; when: root.state == "spread"
729 name: "spread"; when: root.state == "spread"
724− target: appDelegate;
725− x: spreadMaths.animatedX
726− y: spreadMaths.animatedY
728− height: spreadMaths.tileSize + windowInfoItem.height + units.gu(2)
729− requestedWidth: decoratedWindow.oldRequestedWidth
730− requestedHeight: decoratedWindow.oldRequestedHeight
732 PropertyChanges {
730 PropertyChanges {
733 target: decoratedWindow;
731 target: decoratedWindow;
734 showDecoration: false;
732 showDecoration: false;
735− angle: spreadMaths.animatedAngle
733+ angle: spreadMaths.targetAngle
734+ itemScale: spreadMaths.scale
735+ scaleToPreviewSize: spreadItem.stackHeight
736 scaleToPreview: true
736 scaleToPreview: true
740+ x: spreadMaths.targetX
741+ y: spreadMaths.targetY
743+ height: spreadItem.spreadItemHeight
744+ requestedWidth: decoratedWindow.oldRequestedWidth
745+ requestedHeight: decoratedWindow.oldRequestedHeight
738 PropertyChanges { target: inputBlocker; enabled: true }
747 PropertyChanges { target: inputBlocker; enabled: true }
739 PropertyChanges { target: windowInfoItem; opacity: 1 }
748 PropertyChanges { target: windowInfoItem; opacity: 1 }
@@ -840,6 +849,7 @@ AbstractStage {
840 requestedHeight: appDelegate.windowedHeight
849 requestedHeight: appDelegate.windowedHeight
842 PropertyChanges { target: touchControls; enabled: true }
851 PropertyChanges { target: touchControls; enabled: true }
852+ PropertyChanges { target: resizeArea; enabled: true }
845 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
855 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
@@ -930,25 +940,19 @@ AbstractStage {
931 Transition {
941 Transition {
932 to: "spread"
942 to: "spread"
943+ // DecoratedWindow wants the sceleToPreviewSize set before enabling scaleToPreview
944+ PropertyAction { target: decoratedWindow; property: "scaleToPreviewSize" }
945+ PropertyAction { target: decoratedWindow; property: "scaleToPreview" }
933 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
946 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
934− UbuntuNumberAnimation { target: decoratedWindow; properties: "width,height,angle,baseScale"; duration: priv.animationDuration }
947+ UbuntuNumberAnimation { target: decoratedWindow; properties: "width,height,itemScale,angle"; duration: priv.animationDuration }
936 Transition {
949 Transition {
937 from: "spread"; to: "staged,normal"
950 from: "spread"; to: "staged,normal"
938 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
951 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
939− UbuntuNumberAnimation { target: decoratedWindow; properties: "angle,width,height,baseScale"; duration: priv.animationDuration }
952+ UbuntuNumberAnimation { target: decoratedWindow; properties: "width,height,itemScale,angle"; duration: priv.animationDuration }
941 Transition {
954 Transition {
942− from: "normal"; to: "staged";
943− UbuntuNumberAnimation { target: appDelegate; properties: "x,y,requestedWidth,requestedHeight"; duration: priv.animationDuration }
946− from: "normal,spread"; to: "staged"
947− UbuntuNumberAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
948− UbuntuNumberAnimation { target: appDelegate; properties: "requestedWidth,requestedHeight"; duration: priv.animationDuration }
951− from: "nromal,staged"; to: "stagedWithSideStage"
955+ from: "normal,staged"; to: "stagedWithSideStage"
952 UbuntuNumberAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
956 UbuntuNumberAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
953 UbuntuNumberAnimation { target: appDelegate; properties: "requestedWidth,requestedHeight"; duration: priv.animationDuration }
957 UbuntuNumberAnimation { target: appDelegate; properties: "requestedWidth,requestedHeight"; duration: priv.animationDuration }
@@ -983,6 +987,7 @@ AbstractStage {
983 screenWidth: appContainer.width
987 screenWidth: appContainer.width
984 screenHeight: appContainer.height
988 screenHeight: appContainer.height
985 leftMargin: root.leftMargin
989 leftMargin: root.leftMargin
987 onPressed: {
992 onPressed: {
988 print("***** focusing because of resize area press", model.application.appId)
993 print("***** focusing because of resize area press", model.application.appId)
@@ -1047,8 +1052,8 @@ AbstractStage {
1047 property real itemScale: 1
1052 property real itemScale: 1
1048 transform: [
1053 transform: [
1050− origin.x: itemScaleOriginX
1055+ origin.x: 0
1051− origin.y: itemScaleOriginY
1056+ origin.y: decoratedWindow.implicitHeight / 2
1052 xScale: decoratedWindow.itemScale
1057 xScale: decoratedWindow.itemScale
1053 yScale: decoratedWindow.itemScale
1058 yScale: decoratedWindow.itemScale
@@ -1094,11 +1099,7 @@ AbstractStage {
1094 priv.goneToSpread = false;
1099 priv.goneToSpread = false;
1098−// anchors.fill: parent
1102+// Rectangle { anchors.fill: parent; color: "blue"; opacity: .4 }
1103 WindowInfoItem {
1104 WindowInfoItem {
1104 id: windowInfoItem
1105 id: windowInfoItem
@@ -1138,11 +1139,17 @@ AbstractStage {
1139 FloatingFlickable {
1140 FloatingFlickable {
1140 id: floatingFlickable
1141 id: floatingFlickable
1141− anchors.fill: parent
1142+ anchors.fill: appContainer
1142 enabled: false
1143 enabled: false
1144+ contentWidth: spreadItem.spreadTotalWidth
1145+ rightMargin: leftMargin
1147+ var stepOnXAxis = 1 / spreadItem.visibleItemCount
1148+ var distanceToIndex1 = spreadItem.curve.getYFromX(stepOnXAxis)
1149+ var middlePartDistance = spreadItem.curve.getYFromX(0.5 + stepOnXAxis/2) - spreadItem.curve.getYFromX(0.5 - stepOnXAxis/2)
1150+ return 1.2 * (middlePartDistance - distanceToIndex1) * spreadItem.spreadWidth
1144− property int minContentWidth: 6 * Math.min(height / 4, width / 5)
1145− contentWidth: Math.max(6, appRepeater.count) * Math.min(height / 4, width / 5)
1148 PropertyAnimation {
1155 PropertyAnimation {
@@ -1191,8 +1198,12 @@ AbstractStage {
1191 if (gesturePoints[gesturePoints.length - 1] < -root.width / 2) {
1198 if (gesturePoints[gesturePoints.length - 1] < -root.width / 2) {
1192 priv.goneToSpread = true;
1199 priv.goneToSpread = true;
1193 } else {
1200 } else {
1201+ if (appRepeater.count > 1) {
1194− appRepeater.itemAt(0).playHidingAnimation()
1202+ appRepeater.itemAt(0).playHidingAnimation()
1195− appRepeater.itemAt(1).playFocusAnimation()
1203+ appRepeater.itemAt(1).playFocusAnimation()
1205+ appRepeater.itemAt(0).playFocusAnimation();
1198// // Ok. The user released. Find out if it was a one-way movement.
1209// // Ok. The user released. Find out if it was a one-way movement.
@@ -1295,6 +1306,10 @@ AbstractStage {
1297 anchors { left: parent.left; top: parent.top; margins: units.gu(4) }
1308 anchors { left: parent.left; top: parent.top; margins: units.gu(4) }
1298− text: "sidestage z: " + sideStage.z
1309+ text: "spreadWidth: " + spreadItem.spreadWidth
1310+ + "\n spreadItemWidth: " + spreadItem.spreadItemWidth
1311+ + "\n flickableContentWidth: " + floatingFlickable.contentWidth
1312+ + "\n visibleItemCount: " + spreadItem.visibleItemCount
1313+ + "\n contentTopMargin: " + spreadItem.contentTopMargin