@@ -155,6 +155,15 @@ qreal DirectionalDragArea::distance() const
155155 }
156156}
157157
158+qreal DirectionalDragArea::sceneDistance() const
159+{
160+ if (Direction::isHorizontal(m_direction)) {
161+ return m_previousScenePos.x() - m_startScenePos.x();
162+ } else {
163+ return m_previousScenePos.y() - m_startScenePos.y();
164+ }
165+}
166+
158167qreal DirectionalDragArea::touchX() const
159168{
160169 return m_previousPos.x();
@@ -165,6 +174,16 @@ qreal DirectionalDragArea::touchY() const
165174 return m_previousPos.y();
166175}
167176
177+qreal DirectionalDragArea::touchSceneX() const
178+{
179+ return m_previousScenePos.x();
180+}
181+
182+qreal DirectionalDragArea::touchSceneY() const
183+{
184+ return m_previousScenePos.y();
185+}
186+
168187void DirectionalDragArea::touchEvent(QTouchEvent *event)
169188{
170189 if (!isEnabled() || !isVisible()) {
@@ -192,14 +211,17 @@ void DirectionalDragArea::touchEvent_absent(QTouchEvent *event)
192211{
193212 if ((event->touchPointStates() && (Qt::TouchPointPressed || Qt::TouchPointMoved))
194213 && event->touchPoints().count() == 1) {
195− m_startPos = event->touchPoints()[0].pos();
196− m_touchId = event->touchPoints()[0].id();
214+ const QTouchEvent::TouchPoint &touchPoint = event->touchPoints()[0];
215+ m_startPos = touchPoint.pos();
216+ m_startScenePos = touchPoint.scenePos();
217+ m_touchId = touchPoint.id();
197218 m_dampedPos.reset(m_startPos);
198219 updateVelocityCalculator(m_startPos);
199220 m_velocityCalculator->reset();
200221 m_numSamplesOnLastSpeedCheck = 0;
201222 m_silenceTime = 0;
202223 setPreviousPos(m_startPos);
224+ setPreviousScenePos(m_startScenePos);
203225
204226 if (m_distanceThreshold > 0)
205227 setStatus(Undecided);
@@ -242,6 +264,7 @@ void DirectionalDragArea::touchEvent_undecided(QTouchEvent *event)
242264 }
243265
244266 setPreviousPos(touchPos);
267+ setPreviousScenePos(touchPoint->scenePos());
245268
246269 if (movedFarEnough(touchPos)) {
247270 setStatus(Recognized);
@@ -253,6 +276,7 @@ void DirectionalDragArea::touchEvent_recognized(QTouchEvent *event)
253276 const QTouchEvent::TouchPoint *touchPoint = fetchTargetTouchPoint(event);
254277
255278 setPreviousPos(touchPoint->pos());
279+ setPreviousScenePos(touchPoint->scenePos());
256280
257281 if (touchPoint->state() == Qt::TouchPointReleased) {
258282 setStatus(WaitingForTouch);
@@ -398,6 +422,28 @@ void DirectionalDragArea::setPreviousPos(QPointF point)
398422 }
399423}
400424
425+void DirectionalDragArea::setPreviousScenePos(QPointF point)
426+{
427+ Q_ASSERT(m_status != Rejected);
428+
429+ bool xChanged = m_previousScenePos.x() != point.x();
430+ bool yChanged = m_previousScenePos.y() != point.y();
431+
432+ m_previousScenePos = point;
433+
434+ if (xChanged) {
435+ Q_EMIT touchSceneXChanged(point.x());
436+ if (Direction::isHorizontal(m_direction))
437+ Q_EMIT sceneDistanceChanged(sceneDistance());
438+ }
439+
440+ if (yChanged) {
441+ Q_EMIT touchSceneYChanged(point.y());
442+ if (Direction::isVertical(m_direction))
443+ Q_EMIT sceneDistanceChanged(sceneDistance());
444+ }
445+}
446+
401447void DirectionalDragArea::updateVelocityCalculator(QPointF point)
402448{
403449 if (Direction::isHorizontal(m_direction)) {