aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/handlers/qquickdraghandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/handlers/qquickdraghandler.cpp')
-rw-r--r--src/quick/handlers/qquickdraghandler.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/quick/handlers/qquickdraghandler.cpp b/src/quick/handlers/qquickdraghandler.cpp
index 12f1a29bca..d4a8f06db8 100644
--- a/src/quick/handlers/qquickdraghandler.cpp
+++ b/src/quick/handlers/qquickdraghandler.cpp
@@ -93,8 +93,9 @@ bool QQuickDragHandler::wantsEventPoint(QQuickEventPoint *point)
void QQuickDragHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point)
{
- if (grabber == this && stateChange == QQuickEventPoint::GrabExclusive)
- // In case the grab got handled over from another grabber, we might not get the Press
+ if (grabber == this && stateChange == QQuickEventPoint::GrabExclusive && m_targetStartPos.isNull())
+ // In case the grab got handled over from another grabber, we might not get the Press.
+ // Therefore, prefer the m_targetStartPos we got when it got Pressed.
initializeTargetStartPos(point);
enforceConstraints();
QQuickSinglePointHandler::onGrabChanged(grabber, stateChange, point);
@@ -167,7 +168,7 @@ void QQuickDragHandler::enforceAxisConstraints(QPointF *localPos)
void QQuickDragHandler::initializeTargetStartPos(QQuickEventPoint *point)
{
- if (target() && target()->parentItem() && m_targetStartPos.isNull()) { // prefer the m_targetStartPos we got when it got Pressed.
+ if (target() && target()->parentItem()) {
m_targetStartPos = target()->parentItem()->mapToScene(target()->position());
if (!target()->contains(point->position())) {
// If pressed outside of target item, move the target item so that the touchpoint is in its center,