diff --git a/components/mobileshell/components/swipearea.cpp b/components/mobileshell/components/swipearea.cpp index 3a3f13e9..b9f96aa0 100644 --- a/components/mobileshell/components/swipearea.cpp +++ b/components/mobileshell/components/swipearea.cpp @@ -284,7 +284,7 @@ void SwipeArea::handleMoveEvent(QPointerEvent *event, QPointF point) m_lastPos = point; m_stealMouse = true; setMoving(true); - Q_EMIT swipeStarted(m_startPos); + Q_EMIT swipeStarted(m_startPos, m_pressPos); } const QVector2D totalDelta = QVector2D(point - m_startPos); diff --git a/components/mobileshell/components/swipearea.h b/components/mobileshell/components/swipearea.h index 4ee872c9..7b26c1c4 100644 --- a/components/mobileshell/components/swipearea.h +++ b/components/mobileshell/components/swipearea.h @@ -52,7 +52,7 @@ Q_SIGNALS: void pressedChanged(); void swipeEnded(); - void swipeStarted(QPointF point); + void swipeStarted(QPointF currentPoint, QPointF startPoint); // we let the user move a couple of pixels for swipe detection // deltaX, deltaY - amount moved since last swipeMove() // totalDeltaX, totalDeltaY - amount move since startedSwipe() diff --git a/containments/homescreens/folio/homescreenstate.cpp b/containments/homescreens/folio/homescreenstate.cpp index 64222dbf..cc69b6a4 100644 --- a/containments/homescreens/folio/homescreenstate.cpp +++ b/containments/homescreens/folio/homescreenstate.cpp @@ -868,13 +868,17 @@ void HomeScreenState::cancelDelegateDrag() swipeEnded(); } -void HomeScreenState::swipeStarted() +void HomeScreenState::swipeStarted(qreal deltaX, qreal deltaY) { if (m_swipeState != SwipeState::None) { return; } setSwipeState(SwipeState::DeterminingSwipeType); + + // the user interaction has already moved a bit (for swipe detection), + // so we call the move event too. + swipeMoved(deltaX, deltaY, deltaX, deltaY); } void HomeScreenState::swipeEnded() diff --git a/containments/homescreens/folio/homescreenstate.h b/containments/homescreens/folio/homescreenstate.h index d2b1f49a..5c5ae93c 100644 --- a/containments/homescreens/folio/homescreenstate.h +++ b/containments/homescreens/folio/homescreenstate.h @@ -334,7 +334,7 @@ public Q_SLOTS: void cancelDelegateDrag(); // from SwipeArea - void swipeStarted(); + void swipeStarted(qreal deltaX, qreal deltaY); void swipeEnded(); void swipeMoved(qreal totalDeltaX, qreal totalDeltaY, qreal deltaX, qreal deltaY); diff --git a/containments/homescreens/folio/package/contents/ui/HomeScreen.qml b/containments/homescreens/folio/package/contents/ui/HomeScreen.qml index ef50f945..5e9e7338 100644 --- a/containments/homescreens/folio/package/contents/ui/HomeScreen.qml +++ b/containments/homescreens/folio/package/contents/ui/HomeScreen.qml @@ -107,8 +107,10 @@ Item { folio.HomeScreenState.swipeState === Folio.HomeScreenState.SwipingAppDrawerGrid || folio.HomeScreenState.viewState !== Folio.HomeScreenState.AppDrawerView) - onSwipeStarted: { - homeScreenState.swipeStarted(); + onSwipeStarted: (currentPos, startPos) => { + const deltaX = currentPos.x - startPos.x; + const deltaY = currentPos.y - startPos.y; + homeScreenState.swipeStarted(deltaX, deltaY); } onSwipeEnded: { homeScreenState.swipeEnded();