@@ -19,6 +19,7 @@ import QtQuick.Layouts 1.1
1919import Ubuntu.Components 1.3
2020import Ubuntu.Gestures 0.1
2121import Unity.Application 0.1
22+import "../Components"
2223
2324FocusScope {
2425 id: root
@@ -26,8 +27,11 @@ FocusScope {
2627 property bool altTabPressed: false
2728 property Item workspace: null
2829
30+ readonly property alias ready: blurLayer.ready
2931 readonly property alias highlightedIndex: spreadRepeater.highlightedIndex
3032
33+ signal playFocusAnimation(int index)
34+
3135 function show() {
3236 spreadContainer.animateIn = true;
3337 root.state = "altTab";
@@ -91,6 +95,9 @@ FocusScope {
9195
9296 function focusSelected() {
9397 if (spreadRepeater.highlightedIndex != -1) {
98+ if (spreadContainer.visible) {
99+ root.playFocusAnimation(spreadRepeater.highlightedIndex)
100+ }
94101 var application = ApplicationManager.get(spreadRepeater.highlightedIndex);
95102 ApplicationManager.requestFocusApplication(application.appId);
96103 }
@@ -101,6 +108,31 @@ FocusScope {
101108 state = ""
102109 }
103110
111+ BlurLayer {
112+ id: blurLayer
113+ anchors.fill: parent
114+ source: root.workspace
115+ visible: false
116+ }
117+
118+ Rectangle {
119+ id: spreadBackground
120+ anchors.fill: parent
121+ color: "#B2000000"
122+ visible: false
123+ opacity: visible ? 1 : 0
124+ Behavior on opacity {
125+ UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration }
126+ }
127+ }
128+
129+ MouseArea {
130+ id: eventEater
131+ anchors.fill: parent
132+ visible: spreadBackground.visible
133+ enabled: visible
134+ }
135+
104136 Item {
105137 id: spreadContainer
106138 objectName: "spreadContainer"
@@ -226,13 +258,20 @@ FocusScope {
226258 Transition {
227259 from: ""
228260 to: "altTab"
229− PropertyAction { target: spreadDelegate; properties: "y,height,width,angle,z,itemScale,itemScaleOriginY,visible" }
230− PropertyAction { target: clippedSpreadDelegate; properties: "anchors.topMargin" }
231− PropertyAnimation {
232− target: spreadDelegate; properties: "x"
233− from: root.width
234− duration: spreadContainer.animateIn ? UbuntuAnimation.FastDuration :0
235− easing: UbuntuAnimation.StandardEasing
261+ SequentialAnimation {
262+ ParallelAnimation {
263+ PropertyAction { target: spreadDelegate; properties: "y,height,width,angle,z,itemScale,itemScaleOriginY,visible" }
264+ PropertyAction { target: clippedSpreadDelegate; properties: "anchors.topMargin" }
265+ PropertyAnimation {
266+ target: spreadDelegate; properties: "x"
267+ from: root.width
268+ duration: spreadContainer.animateIn ? UbuntuAnimation.FastDuration :0
269+ easing: UbuntuAnimation.StandardEasing
270+ }
271+ UbuntuNumberAnimation { target: clippedSpreadDelegate; property: "shadowOpacity"; from: 0; to: spreadMaths.shadowOpacity; duration: spreadContainer.animateIn ? UbuntuAnimation.FastDuration : 0 }
272+ UbuntuNumberAnimation { target: tileInfo; property: "opacity"; from: 0; to: spreadMaths.tileInfoOpacity; duration: spreadContainer.animateIn ? UbuntuAnimation.FastDuration : 0 }
273+ }
274+ PropertyAction { target: spreadSelectArea; property: "enabled" }
236275 }
237276 }
238277 ]
@@ -262,12 +301,20 @@ FocusScope {
262301 anchors { left: parent.left; top: parent.top; right: parent.right }
263302 spacing: units.gu(1)
264303
265− UbuntuShape {
304+ UbuntuShapeForItem {
266305 Layout.preferredHeight: Math.min(units.gu(6), root.height * .05)
267306 Layout.preferredWidth: height * 8 / 7.6
268307 image: Image {
269308 anchors.fill: parent
270309 source: model.icon
310+ Rectangle {
311+ anchors.fill: parent
312+ color: "black"
313+ opacity: clippedSpreadDelegate.highlightShown ? 0 : .1
314+ Behavior on opacity {
315+ UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration }
316+ }
317+ }
271318 }
272319 }
273320 Label {
@@ -420,7 +467,7 @@ FocusScope {
420467
421468 property var source: ShaderEffectSource {
422469 id: shaderEffectSource
423− sourceItem: appContainer
470+ sourceItem: root.workspace
424471 }
425472
426473 fragmentShader: "
@@ -494,20 +541,17 @@ FocusScope {
494541 from: "*"
495542 to: "altTab"
496543 SequentialAnimation {
497− PropertyAction { target: hoverMouseArea; property: "progressiveScrollingEnabled"; value: false }
498544 PropertyAction { target: spreadRepeater; property: "highlightedIndex"; value: Math.min(ApplicationManager.count - 1, 1) }
499− PauseAnimation { duration: 140 }
545+ PauseAnimation { duration: spreadContainer.animateIn ? 0 : 140 }
500546 PropertyAction { target: workspaceSelector; property: "visible" }
501547 PropertyAction { target: spreadContainer; property: "visible" }
502548 ParallelAnimation {
503− UbuntuNumberAnimation {
504− target: blurLayer; properties: "saturation,blurRadius";
505− duration: spreadContainer.animateIn ? UbuntuAnimation.FastDuration : 0
506− }
549+ UbuntuNumberAnimation { target: blurLayer; properties: "saturation,blurRadius"; duration: UbuntuAnimation.SnapDuration }
507550 PropertyAction { target: spreadFlickable; property: "visible" }
508551 PropertyAction { targets: [currentSelectedLabel,spreadBackground]; property: "visible" }
509552 PropertyAction { target: spreadFlickable; property: "contentX"; value: 0 }
510553 }
554+ PropertyAction { target: hoverMouseArea; properties: "enabled,progressiveScrollingEnabled"; value: false }
511555 }
512556 },
513557 Transition {
@@ -518,6 +562,5 @@ FocusScope {
518562 PropertyAction { target: spreadRepeater; property: "highlightedIndex"; value: -1 }
519563 PropertyAction { target: spreadContainer; property: "animateIn"; value: false }
520564 }
521−
522565 ]
523566}