Skip to content

Commit

Permalink
Pan image when resizing window to maintain focal point
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpurcell committed Dec 26, 2024
1 parent 158c934 commit 49d733d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/qvgraphicsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ void QVGraphicsView::resizeEvent(QResizeEvent *event)
return;

QGraphicsView::resizeEvent(event);

const QPoint sizeDelta = QRect(QPoint(), event->size()).bottomRight() - QRect(QPoint(), event->oldSize()).bottomRight();
scrollHelper->move(sizeDelta.toPointF() / -2.0);
fitOrConstrainImage();
}

Expand Down

0 comments on commit 49d733d

Please sign in to comment.