Skip to content

Commit

Permalink
WIP: attempt to fix crazy multitouch behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
askmeaboutlo0m committed Sep 9, 2023
1 parent 6ba2e64 commit 42f3661
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/desktop/scene/canvasview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,14 +1503,14 @@ void CanvasView::touchEvent(QTouchEvent *event)
}
startAvgDist = sqrt(startAvgDist);

qreal zoom = m_zoom;
qreal touchZoom = zoom();
if(m_enableTouchPinch) {
avgDist = sqrt(avgDist);
const qreal dZoom = avgDist / startAvgDist;
zoom = m_touchStartZoom * dZoom;
touchZoom = m_touchStartZoom * dZoom;
}

qreal rotate = m_rotate;
qreal touchRotation = rotation();
if(m_enableTouchTwist) {
const auto &tps = compat::touchPoints(*event);

Expand All @@ -1531,14 +1531,14 @@ void CanvasView::touchEvent(QTouchEvent *event)
if(startAvgDist / m_dpi > 0.8 &&
(qAbs(dAngle) > 3.0 || m_touchRotating)) {
m_touchRotating = true;
rotate = m_touchStartRotate + dAngle;
touchRotation = m_touchStartRotate + dAngle;
}
}

{
QScopedValueRollback<bool> guard{m_blockNotices, true};
setZoom(zoom);
setRotation(rotate);
setZoom(touchZoom);
setRotation(touchRotation);
}

if(m_enableTouchPinch) {
Expand All @@ -1551,10 +1551,6 @@ void CanvasView::touchEvent(QTouchEvent *event)
} else if(m_enableTouchTwist) {
showTransformNotice(getRotationNotice());
}
updateCanvasTransform([&] {
m_zoom = zoom;
m_rotate = rotate;
});
}
}
break;
Expand Down

0 comments on commit 42f3661

Please sign in to comment.