on xenial help sign in
exit spread on background tap Fixes: 1368261

Approved by: Michael Terry

commit036c964952186501e5040ecbfea3d82f04d9d51f authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 30 Oct 2014, 21:41 (12 years ago) parentb054b24f79fc17
3 files changed+28−2
qml/Stages/PhoneStage.qml+6−1 qml/Stages/TabletStage.qml+5−1 tests/qmltests/Stages/tst_PhoneStage.qml+17
qml/Stages/PhoneStage.qml+6−1
@@ -246,12 +246,13 @@ Rectangle {
246246 }
247247 }
248248
249− Item {
249+ MouseArea {
250250 id: spreadRow
251251 // This width controls how much the spread can be flicked left/right. It's composed of:
252252 // tileDistance * app count (with a minimum of 3 apps, in order to also allow moving 1 and 2 apps a bit)
253253 // + some constant value (still scales with the screen width) which looks good and somewhat fills the screen
254254 width: Math.max(3, ApplicationManager.count) * spreadView.tileDistance + (spreadView.width - spreadView.tileDistance) * 1.5
255+ height: parent.height
255256 Behavior on width {
256257 enabled: spreadView.closingIndex >= 0
257258 UbuntuNumberAnimation {}
@@ -264,6 +265,10 @@ Rectangle {
264265
265266 x: spreadView.contentX
266267
268+ onClicked: {
269+ spreadView.snapTo(0);
270+ }
271+
267272 Repeater {
268273 id: spreadRepeater
269274 model: ApplicationManager
qml/Stages/TabletStage.qml+5−1
@@ -386,12 +386,16 @@ Rectangle {
386386 }
387387 }
388388
389− Item {
389+ MouseArea {
390390 id: spreadRow
391391 x: spreadView.contentX
392392 height: root.height
393393 width: spreadView.width + Math.max(spreadView.width, ApplicationManager.count * spreadView.tileDistance)
394394
395+ onClicked: {
396+ spreadView.snapTo(0);
397+ }
398+
395399 Rectangle {
396400 id: sideStageBackground
397401 color: "black"
tests/qmltests/Stages/tst_PhoneStage.qml+17
@@ -314,6 +314,23 @@ Item {
314314 tryCompare(app, "orientation", Qt.LandscapeOrientation);
315315 }
316316
317+ function test_backgroundClickCancelsSpread() {
318+ addApps(3);
319+
320+ var focusedAppId = ApplicationManager.focusedApplicationId;
321+
322+ goToSpread();
323+
324+ mouseClick(phoneStage, units.gu(1), units.gu(1));
325+
326+ // Make sure the spread is in the idle position
327+ var spreadView = findChild(phoneStage, "spreadView");
328+ tryCompare(spreadView, "contentX", -spreadView.shift);
329+
330+ // Make sure the same app is still focused
331+ compare(focusedAppId, ApplicationManager.focusedApplicationId);
332+ }
333+
317334 function cleanup() {
318335 while (ApplicationManager.count > 1) {
319336 var oldCount = ApplicationManager.count;