Skip to content

Commit

Permalink
macOS: improve viewer pan
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Jan 12, 2025
1 parent 64ff2da commit a3792c3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/GUI/canvaswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,12 @@ void CanvasWindow::wheelEvent(QWheelEvent *event)
if (event->phase() == Qt::ScrollUpdate ||
event->phase() == Qt::ScrollMomentum) {
auto pos = mPrevMousePos;
const qreal zoom = mViewTransform.m11() * 1.5;
if (event->angleDelta().y() != 0) {
pos.setY(pos.y() + event->angleDelta().y());
pos.setY(pos.y() + event->angleDelta().y() / zoom);
}
if (event->angleDelta().x() != 0) {
pos.setX(pos.x() + event->angleDelta().x());
pos.setX(pos.x() + event->angleDelta().x() / zoom);
}
translateView(pos - mPrevMousePos);
mPrevMousePos = pos;
Expand Down

0 comments on commit a3792c3

Please sign in to comment.