on xenial help sign in
Fixes in the spread after design review

- add a minimum width for the tile info to prevent it going to ... - tiles should not be interactive any more when moving to spread - add some resistance to the drag when an app is not closeable - allow rotating when there is no app focused - add a fade in animation to the icons in the spread - fix spread looking out of place when there's only one item (LP: #1637502, #1638848) Approved by: Lukáš Tinkl

commit4903e3d68348827080d069a5e7deec7dee6ef9bd authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 9 Nov 2016, 15:05 (10 years ago) parent6813eb0242a3d7
4 files changed+25−9
qml/Shell.qml+2−1 qml/Stage/Spread/Spread.qml+1−1 qml/Stage/Spread/SpreadDelegateInputArea.qml+7−1 qml/Stage/Stage.qml+15−6
qml/Shell.qml+2−1
@@ -442,9 +442,10 @@ StyledItem {
442442 }
443443
444444 if (!greeter.locked && tutorial.launcherLongSwipeEnabled
445− && ApplicationManager.focusedApplicationId != "unity8-dash") {
445+ && (ApplicationManager.focusedApplicationId != "unity8-dash" || stage.spreadShown)) {
446446 ApplicationManager.requestFocusApplication("unity8-dash")
447447 launcher.fadeOut();
448+ stage.closeSpread();
448449 }
449450 }
450451
qml/Stage/Spread/Spread.qml+1−1
@@ -91,7 +91,7 @@ Item {
9191
9292 readonly property real visibleItemCount: (spreadWidth / spreadItemWidth) / (1 - itemOverlap)
9393
94− readonly property real spreadTotalWidth: totalItemCount * spreadWidth / visibleItemCount
94+ readonly property real spreadTotalWidth: Math.max(2,totalItemCount) * spreadWidth / visibleItemCount
9595
9696 readonly property real centeringOffset: Math.max(spreadWidth - spreadTotalWidth ,0) / (2 * spreadWidth)
9797
qml/Stage/Spread/SpreadDelegateInputArea.qml+7−1
@@ -119,7 +119,13 @@ Item {
119119 }
120120 }
121121
122− d.distance = tp.y - tp.startY - offset
122+ if (root.closeable) {
123+ d.distance = tp.y - tp.startY - offset
124+ } else {
125+ var value = tp.y - tp.startY - offset;
126+ d.distance = Math.sqrt(Math.abs(value)) * (value < 0 ? -1 : 1) * 3
127+ }
128+
123129 d.pushDragEvent(tp);
124130 }
125131
qml/Stage/Stage.qml+15−6
@@ -53,18 +53,18 @@ FocusScope {
5353 property real leftEdgeDragProgress: 0
5454
5555 // Used by the tutorial code
56− readonly property bool spreadShown: state == "spread"
5756 readonly property real rightEdgeDragProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0 // How far left the stage has been dragged
5857
5958 // used by the snap windows (edge maximize) feature
6059 readonly property alias previewRectangle: fakeRectangle
6160
61+ readonly property bool spreadShown: state == "spread"
6262 readonly property var mainApp: priv.focusedAppDelegate ? priv.focusedAppDelegate.application : null
6363
6464 // application windows never rotate independently
6565 property int mainAppWindowOrientationAngle: shellOrientationAngle
6666
67− property bool orientationChangesEnabled: priv.focusedAppDelegate && priv.focusedAppDelegate.orientationChangesEnabled
67+ property bool orientationChangesEnabled: !priv.focusedAppDelegate || priv.focusedAppDelegate.orientationChangesEnabled
6868
6969 property int supportedOrientations: {
7070 if (mainApp) {
@@ -105,9 +105,13 @@ FocusScope {
105105 edgeBarrier.push(amount);
106106 }
107107
108+ function closeSpread() {
109+ priv.goneToSpread = false;
110+ }
111+
108112 onSpreadEnabledChanged: {
109− if (!spreadEnabled && root.state == "spread") {
110− priv.goneToSpread = false;
113+ if (!spreadEnabled && spreadShown) {
114+ closeSpread();
111115 }
112116 }
113117
@@ -481,7 +485,7 @@ FocusScope {
481485 }
482486 },
483487 Transition {
484− to: "stagedRightEdge"
488+ to: "stagedRightEdge,sideStagedRightEdge"
485489 PropertyAction { target: floatingFlickable; property: "contentX"; value: 0 }
486490 },
487491 Transition {
@@ -1078,6 +1082,7 @@ FocusScope {
10781082 showHighlight: spreadItem.highlightedIndex === index
10791083 darkening: spreadItem.highlightedIndex >= 0
10801084 anchors.topMargin: dragArea.distance
1085+ interactive: false
10811086 }
10821087 PropertyChanges {
10831088 target: appDelegate
@@ -1117,7 +1122,10 @@ FocusScope {
11171122 scaleToPreviewSize: spreadItem.stackHeight
11181123 scaleToPreviewProgress: stagedRightEdgeMaths.scaleToPreviewProgress
11191124 shadowOpacity: .3
1125+ interactive: false
11201126 }
1127+ // make sure it's visible but transparent so it fades in when we transition to spread
1128+ PropertyChanges { target: windowInfoItem; opacity: 0; visible: true }
11211129 },
11221130 State {
11231131 name: "windowedRightEdge"
@@ -1376,6 +1384,7 @@ FocusScope {
13761384 PropertyAction { target: decoratedWindow; property: "scaleToPreviewSize" }
13771385 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
13781386 UbuntuNumberAnimation { target: decoratedWindow; properties: "width,height,itemScale,angle,scaleToPreviewProgress"; duration: priv.animationDuration }
1387+ UbuntuNumberAnimation { target: windowInfoItem; properties: "opacity"; duration: priv.animationDuration }
13791388 },
13801389 Transition {
13811390 from: "normal,staged"; to: "stagedWithSideStage"
@@ -1588,7 +1597,7 @@ FocusScope {
15881597 maxWidth: {
15891598 var nextApp = appRepeater.itemAt(index + 1);
15901599 if (nextApp) {
1591− return nextApp.x - appDelegate.x - units.gu(1)
1600+ return Math.max(iconHeight, nextApp.x - appDelegate.x - units.gu(1))
15921601 }
15931602 return appDelegate.width;
15941603 }