on xenial help sign in
only show the animation when the gesture is recognized. simplify code
72b5f59Michael Zanetti
qml/Stages/PhoneStage.qml+6−14
@@ -241,7 +241,7 @@ Item {
241 Flickable {
241 Flickable {
242 id: spreadView
242 id: spreadView
243 anchors.fill: parent
243 anchors.fill: parent
244− visible: spreadDragArea.dragging || stage > 0 || snapAnimation.running
244+ visible: spreadDragArea.status == DirectionalDragArea.Recognized || stage > 0 || snapAnimation.running
245 contentWidth: spreadRow.width - shift
245 contentWidth: spreadRow.width - shift
246 contentX: -shift
246 contentX: -shift
247
247
@@ -371,20 +371,12 @@ Item {
371 x: index == 0 ? 0 : spreadView.width + (index - 1) * spreadView.tileDistance
371 x: index == 0 ? 0 : spreadView.width + (index - 1) * spreadView.tileDistance
372
372
373 progress: {
373 progress: {
374− switch (index) {
375− case 0:
376− return spreadView.shiftedContentX / spreadView.width;
377− case 1:
378− var progress = spreadView.shiftedContentX / spreadView.width;
374+ var tileProgress = (spreadView.shiftedContentX - index * spreadView.tileDistance) / spreadView.width
379− if (spreadView.stage == 2) {
375+ // Tile 1 needs to move directly from the beginning...
376+ if (index == 1 && spreadView.stage < 2) {
380− progress -= spreadView.tileDistance / spreadView.width;
377+ tileProgress += spreadView.tileDistance / spreadView.width
381− }
382− return progress;
383 }
378 }
384− // This delays the progress for all tiles > 1 for the duration of stage 1
379+ return tileProgress;
385− var stage1Distance = spreadView.positionMarker2 * spreadView.width;
386− var tileDistance = (index - 2) * spreadView.tileDistance;
387− return (spreadView.shiftedContentX - stage1Distance - tileDistance) / spreadView.width;
388 }
380 }
389
381
390 animatedProgress: {
382 animatedProgress: {