on xenial help sign in
Make the xyscaler be a different item and not scopeItem itself
e21eb51Albert Astals
qml/Dash/Dash.qml+48−34
@@ -111,14 +111,15 @@ Showable {
111 target: scopesOverview.scope
111 target: scopesOverview.scope
112 onOpenScope: {
112 onOpenScope: {
113 scopeItem.scope = scope;
113 scopeItem.scope = scope;
114+ scopeItem.parent = scopesOverviewXYScaler;
114− scopeItem.overviewScale = scopesOverview.allCardSize.width / scopeItem.width;
115+ scopesOverviewXYScaler.scale = scopesOverview.allCardSize.width / scopesOverviewXYScaler.width;
115− scopeItem.x = scopesOverview.allScopeClickedPos.x -(scopeItem.width - scopeItem.width * scopeItem.overviewScale) / 2;
116+ scopesOverviewXYScaler.x = scopesOverview.allScopeClickedPos.x -(scopesOverviewXYScaler.width - scopesOverviewXYScaler.width * scopesOverviewXYScaler.scale) / 2;
116− scopeItem.y = scopesOverview.allScopeClickedPos.y -(scopeItem.height - scopeItem.height * scopeItem.overviewScale) / 2;
117+ scopesOverviewXYScaler.y = scopesOverview.allScopeClickedPos.y -(scopesOverviewXYScaler.height - scopesOverviewXYScaler.height * scopesOverviewXYScaler.scale) / 2;
117 overviewController.showingNonFavoriteScope = true;
118 overviewController.showingNonFavoriteScope = true;
118 scopesOverview.overrideOpacity = 0;
119 scopesOverview.overrideOpacity = 0;
119− scopeItem.overviewScale = 1;
120+ scopesOverviewXYScaler.scale = 1;
120− scopeItem.x = 0;
121+ scopesOverviewXYScaler.x = 0;
121− scopeItem.y = 0;
122+ scopesOverviewXYScaler.y = 0;
122 }
123 }
123 }
124 }
124 }
125 }
@@ -165,41 +166,19 @@ Showable {
165 DashBackground
166 DashBackground
166 {
167 {
167 anchors.fill: scopeItem
168 anchors.fill: scopeItem
168− scale: scopeItem.scale
169 visible: scopeItem.visible
169 visible: scopeItem.visible
170+ parent: scopeItem.parent
170 }
171 }
171
172
172 GenericScopeView {
173 GenericScopeView {
173 id: scopeItem
174 id: scopeItem
174
175
175− property real overviewScale: 1
176−
177 // TODO test this width + dashContent.x still works
176 // TODO test this width + dashContent.x still works
178 x: overviewController.showingNonFavoriteScope ? 0 : width + dashContent.x
177 x: overviewController.showingNonFavoriteScope ? 0 : width + dashContent.x
179− Behavior on x {
178+ z: 1
180− enabled: overviewController.showingNonFavoriteScope
181− UbuntuNumberAnimation { }
182− }
183− Behavior on y {
184− enabled: overviewController.showingNonFavoriteScope
185− UbuntuNumberAnimation { }
186− }
187 width: parent.width
179 width: parent.width
188 height: parent.height
180 height: parent.height
189− scale: dash.contentScale * overviewScale
181+ scale: dash.contentScale
190− enabled: scale == 1
191− Behavior on overviewScale {
192− enabled: overviewController.showingNonFavoriteScope
193− UbuntuNumberAnimation {
194− onRunningChanged: {
195− if (!running && scopeItem.overviewScale != 1) {
196− scopesOverview.scope.closeScope(scopeItem.scope);
197− overviewController.showingNonFavoriteScope = false;
198− scopeItem.scope = null;
199− }
200− }
201− }
202− }
203 clip: scale != 1.0
182 clip: scale != 1.0
204 visible: scope != null
183 visible: scope != null
205 hasBackAction: true
184 hasBackAction: true
@@ -207,9 +186,9 @@ Showable {
207 onBackClicked: {
186 onBackClicked: {
208 if (overviewController.showingNonFavoriteScope) {
187 if (overviewController.showingNonFavoriteScope) {
209 var v = scopesOverview.allCardSize.width / scopeItem.width;
188 var v = scopesOverview.allCardSize.width / scopeItem.width;
210− scopeItem.overviewScale = v;
189+ scopesOverviewXYScaler.scale = v;
211− scopeItem.x = scopesOverview.allScopeClickedPos.x -(scopeItem.width - scopeItem.width * v) / 2;
190+ scopesOverviewXYScaler.x = scopesOverview.allScopeClickedPos.x -(scopeItem.width - scopeItem.width * v) / 2;
212− scopeItem.y = scopesOverview.allScopeClickedPos.y -(scopeItem.height - scopeItem.height * v) / 2;
191+ scopesOverviewXYScaler.y = scopesOverview.allScopeClickedPos.y -(scopeItem.height - scopeItem.height * v) / 2;
213 scopesOverview.overrideOpacity = -1;
192 scopesOverview.overrideOpacity = -1;
214 } else {
193 } else {
215 closeOverlayScope();
194 closeOverlayScope();
@@ -228,6 +207,41 @@ Showable {
228 }
207 }
229 }
208 }
230
209
210+ Item {
211+ id: scopesOverviewXYScaler
212+ width: parent.width
213+ height: parent.height
214+
215+ clip: scale != 1.0
216+ enabled: scale == 1
217+ opacity: scale
218+
219+ Behavior on x {
220+ enabled: overviewController.showingNonFavoriteScope
221+ UbuntuNumberAnimation { }
222+ }
223+ Behavior on y {
224+ enabled: overviewController.showingNonFavoriteScope
225+ UbuntuNumberAnimation { }
226+ }
227+
228+ Behavior on scale {
229+ enabled: overviewController.showingNonFavoriteScope
230+ UbuntuNumberAnimation {
231+ onRunningChanged: {
232+ if (overviewController.showingNonFavoriteScope) {
233+ if (!running && scopesOverviewXYScaler.scale != 1) {
234+ scopesOverview.scope.closeScope(scopeItem.scope);
235+ overviewController.showingNonFavoriteScope = false;
236+ scopeItem.scope = null;
237+ scopeItem.parent = dash;
238+ }
239+ }
240+ }
241+ }
242+ }
243+ }
244+
231 EdgeDragArea {
245 EdgeDragArea {
232 id: overviewDragHandle
246 id: overviewDragHandle
233 z: 1
247 z: 1