From eca762e5b5569d89a9c9ec565778142236ca58d3 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Jan 07 2019 07:10:07 +0000 Subject: Fix hand tool pan --- diff --git a/toonz/sources/toonzqt/schematicviewer.cpp b/toonz/sources/toonzqt/schematicviewer.cpp index 2ed4ec5..904fda4 100644 --- a/toonz/sources/toonzqt/schematicviewer.cpp +++ b/toonz/sources/toonzqt/schematicviewer.cpp @@ -237,12 +237,16 @@ void SchematicSceneViewer::mousePressEvent(QMouseEvent *me) { m_zooming = true; return; } else if (m_cursorMode == CursorMode::Hand) { - m_firstPanPoint = mapToScene(me->pos()); - m_panning = true; + m_firstPanPoint = m_touchDevice == QTouchDevice::TouchScreen + ? mapToScene(me->pos()) + : me->pos(); + m_panning = true; return; } } else if (m_buttonState == Qt::MidButton) { - m_firstPanPoint = mapToScene(me->pos()); + m_firstPanPoint = m_touchDevice == QTouchDevice::TouchScreen + ? mapToScene(me->pos()) + : me->pos(); } bool drawRect = true; QList pointedItems = items(me->pos()); @@ -275,9 +279,14 @@ void SchematicSceneViewer::mouseMoveEvent(QMouseEvent *me) { QPointF currScenePos = mapToScene(currWinPos); if ((m_cursorMode == CursorMode::Hand && m_panning) || m_buttonState == Qt::MidButton) { - QPointF deltaPoint = ((mapToScene(me->pos()) * getDevPixRatio()) - - (m_firstPanPoint * getDevPixRatio())); + QPointF usePos = + m_touchDevice == QTouchDevice::TouchScreen ? currScenePos : currWinPos; + QPointF deltaPoint = + ((usePos * getDevPixRatio()) - (m_firstPanPoint * getDevPixRatio())); panQt(deltaPoint); + m_firstPanPoint = m_touchDevice == QTouchDevice::TouchScreen + ? mapToScene(me->pos()) + : me->pos(); } else { if (m_cursorMode == CursorMode::Zoom && m_zooming) { int deltaY = (m_oldWinPos.y() - me->pos().y()) * 10;