on xenial help sign in
Animate Dash growing from the All screen
8cc984dAlbert Astals
qml/Dash/Dash.qml+34−8
@@ -81,6 +81,7 @@ Showable {
81 property alias enableAnimation: progressAnimation.enabled
81 property alias enableAnimation: progressAnimation.enabled
82 property real progress: 0
82 property real progress: 0
83 property bool showingNonFavoriteScope: false
83 property bool showingNonFavoriteScope: false
84+ property bool growingDashFromAll: false
84 Behavior on progress {
85 Behavior on progress {
85 id: progressAnimation
86 id: progressAnimation
86 UbuntuNumberAnimation { }
87 UbuntuNumberAnimation { }
@@ -96,7 +97,20 @@ Showable {
96 scopeScale: 1 - overviewController.progress * 0.6
97 scopeScale: 1 - overviewController.progress * 0.6
97 visible: scopeScale != 1
98 visible: scopeScale != 1
98 currentIndex: dashContent.currentIndex
99 currentIndex: dashContent.currentIndex
99− onDone: hide();
100+ onDone: {
101+ if (dashContent.parent == scopesOverviewXYScaler) {
102+ // Animate Dash growing from the All screen
103+ // TODO find where the thing comes from for that x, y
104+ scopesOverviewXYScaler.scale = scopesOverview.allCardSize.width / scopesOverviewXYScaler.width;
105+ scopesOverviewXYScaler.x = /*scopesOverview.allScopeClickedPos.x*/ -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2;
106+ scopesOverviewXYScaler.y = /*scopesOverview.allScopeClickedPos.y*/ -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2;
107+ overviewController.growingDashFromAll = true;
108+ scopesOverviewXYScaler.scale = 1;
109+ scopesOverviewXYScaler.x = 0;
110+ scopesOverviewXYScaler.y = 0;
111+ }
112+ hide();
113+ }
100 onFavoriteSelected: {
114 onFavoriteSelected: {
101 dashContent.setCurrentScopeAtIndex(index, false, false);
115 dashContent.setCurrentScopeAtIndex(index, false, false);
102 hide();
116 hide();
@@ -126,7 +140,15 @@ Showable {
126
140
127 DashContent {
141 DashContent {
128 id: dashContent
142 id: dashContent
143+ parent: {
129− parent: overviewController.progress == 0 ? dash : scopesOverview.dashItemEater
144+ if (overviewController.progress == 0) {
145+ return dash;
146+ } else if (scopesOverview.dashItemEater) {
147+ return scopesOverview.dashItemEater;
148+ } else {
149+ return scopesOverviewXYScaler;
150+ }
151+ }
130 objectName: "dashContent"
152 objectName: "dashContent"
131 width: dash.width
153 width: dash.width
132 height: dash.height
154 height: dash.height
@@ -160,7 +182,7 @@ Showable {
160 }
182 }
161
183
162 enabled: opacity == 1
184 enabled: opacity == 1
163− opacity: 1 - overviewController.progress
185+ opacity: overviewController.growingDashFromAll ? 1 : 1 - overviewController.progress
164 }
186 }
165
187
166 DashBackground
188 DashBackground
@@ -216,25 +238,29 @@ Showable {
216 enabled: scale == 1
238 enabled: scale == 1
217 opacity: scale
239 opacity: scale
218
240
241+ property bool animationsEnabled: overviewController.showingNonFavoriteScope || overviewController.growingDashFromAll
242+
219 Behavior on x {
243 Behavior on x {
220− enabled: overviewController.showingNonFavoriteScope
244+ enabled: scopesOverviewXYScaler.animationsEnabled
221 UbuntuNumberAnimation { }
245 UbuntuNumberAnimation { }
222 }
246 }
223 Behavior on y {
247 Behavior on y {
224− enabled: overviewController.showingNonFavoriteScope
248+ enabled: scopesOverviewXYScaler.animationsEnabled
225 UbuntuNumberAnimation { }
249 UbuntuNumberAnimation { }
226 }
250 }
227
251
228 Behavior on scale {
252 Behavior on scale {
229− enabled: overviewController.showingNonFavoriteScope
253+ enabled: scopesOverviewXYScaler.animationsEnabled
230 UbuntuNumberAnimation {
254 UbuntuNumberAnimation {
231 onRunningChanged: {
255 onRunningChanged: {
256+ if (!running) {
232− if (overviewController.showingNonFavoriteScope) {
257+ if (overviewController.showingNonFavoriteScope && scopesOverviewXYScaler.scale != 1) {
233− if (!running && scopesOverviewXYScaler.scale != 1) {
234 scopesOverview.scope.closeScope(scopeItem.scope);
258 scopesOverview.scope.closeScope(scopeItem.scope);
235 overviewController.showingNonFavoriteScope = false;
259 overviewController.showingNonFavoriteScope = false;
236 scopeItem.scope = null;
260 scopeItem.scope = null;
237 scopeItem.parent = dash;
261 scopeItem.parent = dash;
262+ } else if (overviewController.growingDashFromAll) {
263+ overviewController.growingDashFromAll = false;
238 }
264 }
239 }
265 }
240 }
266 }
qml/Dash/ScopesOverview.qml+21−7
@@ -24,7 +24,7 @@ Item {
24 property real progress: 0
24 property real progress: 0
25 property var scope: null
25 property var scope: null
26 property var dashItemEater: {
26 property var dashItemEater: {
27− if (middleItems.count > 0) {
27+ if (tabBarHolder.currentTab == 0 && middleItems.count > 0) {
28 var loaderItem = middleItems.itemAt(0).item;
28 var loaderItem = middleItems.itemAt(0).item;
29 return loaderItem && loaderItem.currentItem ? loaderItem.currentItem : null;
29 return loaderItem && loaderItem.currentItem ? loaderItem.currentItem : null;
30 }
30 }
@@ -53,6 +53,12 @@ Item {
53 signal favoriteSelected(int index)
53 signal favoriteSelected(int index)
54 signal allSelected(var scope)
54 signal allSelected(var scope)
55
55
56+ onProgressChanged: {
57+ if (progress == 0) {
58+ tabBarHolder.currentTab = 0;
59+ }
60+ }
61+
56 DashBackground {
62 DashBackground {
57 anchors.fill: parent
63 anchors.fill: parent
58 Rectangle {
64 Rectangle {
@@ -144,8 +150,19 @@ Item {
144
150
145 scale: index == 0 ? scopeScale : 1
151 scale: index == 0 ? scopeScale : 1
146
152
153+ opacity: {
154+ if (root.overrideOpacity >= 0)
155+ return root.overrideOpacity;
156+
147− opacity: root.overrideOpacity >= 0 ? root.overrideOpacity : tabBarHolder.currentTab == index ? 1 : 0
157+ if (tabBarHolder.currentTab != index)
158+ return 0;
159+
160+ return index == 0 ? 1 : root.progress;
161+ }
162+ Behavior on opacity {
163+ enabled: root.progress == 1
148− Behavior on opacity { UbuntuNumberAnimation { } }
164+ UbuntuNumberAnimation { }
165+ }
149 enabled: opacity == 1
166 enabled: opacity == 1
150
167
151 clip: index == 1
168 clip: index == 1
@@ -238,10 +255,7 @@ Item {
238 text: i18n.tr("Done")
255 text: i18n.tr("Done")
239 color: parent.pressed ? "black" : "white"
256 color: parent.pressed ? "black" : "white"
240 }
257 }
241− onClicked: {
258+ onClicked: root.done();
242− root.done();
243− tabBarHolder.currentTab = 0;
244− }
245 }
259 }
246 }
260 }
247 }
261 }