on xenial help sign in
exit spread on background tap
commit5f2a099b7175e8c7303e24085b3ce687acbfb934 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 10 Oct 2014, 15:47 (12 years ago) parenteeac5a6
3 files changed+19−2
qml/Stages/PhoneStage.qml+6−1 qml/Stages/TabletStage.qml+3−1 tests/qmltests/Stages/tst_PhoneStage.qml+10
qml/Stages/PhoneStage.qml+6−1
@@ -237,12 +237,13 @@ Rectangle {
237237 }
238238 }
239239
240− Item {
240+ MouseArea {
241241 id: spreadRow
242242 // This width controls how much the spread can be flicked left/right. It's composed of:
243243 // tileDistance * app count (with a minimum of 3 apps, in order to also allow moving 1 and 2 apps a bit)
244244 // + some constant value (still scales with the screen width) which looks good and somewhat fills the screen
245245 width: Math.max(3, ApplicationManager.count) * spreadView.tileDistance + (spreadView.width - spreadView.tileDistance) * 1.5
246+ height: parent.height
246247 Behavior on width {
247248 enabled: spreadView.closingIndex >= 0
248249 UbuntuNumberAnimation {}
@@ -255,6 +256,10 @@ Rectangle {
255256
256257 x: spreadView.contentX
257258
259+ onClicked: {
260+ spreadView.snapTo(0)
261+ }
262+
258263 Repeater {
259264 id: spreadRepeater
260265 model: ApplicationManager
qml/Stages/TabletStage.qml+3−1
@@ -378,12 +378,14 @@ Rectangle {
378378 }
379379 }
380380
381− Item {
381+ MouseArea {
382382 id: spreadRow
383383 x: spreadView.contentX
384384 height: root.height
385385 width: spreadView.width + Math.max(spreadView.width, ApplicationManager.count * spreadView.tileDistance)
386386
387+ onClicked: spreadView.snapTo(0)
388+
387389 Rectangle {
388390 id: sideStageBackground
389391 color: "black"
tests/qmltests/Stages/tst_PhoneStage.qml+10
@@ -313,6 +313,16 @@ Item {
313313 tryCompare(app, "orientation", Qt.LandscapeOrientation);
314314 }
315315
316+ function test_backgroundClickCancelsSpread() {
317+ addApps(3)
318+ goToSpread();
319+
320+ mouseClick(phoneStage, units.gu(1), units.gu(1))
321+
322+ var spreadView = findChild(phoneStage, "spreadView");
323+ tryCompare(spreadView, "contentX", -spreadView.shift)
324+ }
325+
316326 function cleanup() {
317327 while (ApplicationManager.count > 1) {
318328 var oldCount = ApplicationManager.count;