Skip to content

Commit

Permalink
fix #181861: Pinch/spread to zoom uses wrong centerpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Mar 20, 2017
1 parent fee488e commit 427c239
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mscore/scoreview.cpp
Expand Up @@ -2100,14 +2100,14 @@ void ScoreView::zoom(qreal _mag, const QPointF& pos)
_mag = 0.05;

mscore->setMag(_mag);
setMag(_mag * (mscore->physicalDotsPerInch() / DPI));
_magIdx = MagIdx::MAG_FREE;

QPointF p2 = imatrix.map(pos);
QPointF p3 = p2 - p1;
double m = _mag * mscore->physicalDotsPerInch() / DPI;

double m = _mag;
setMag(m);

_magIdx = MagIdx::MAG_FREE;
QPointF p2 = imatrix.map(pos);
QPointF p3 = p2 - p1;
int dx = lrint(p3.x() * m);
int dy = lrint(p3.y() * m);

Expand Down Expand Up @@ -2144,7 +2144,9 @@ bool ScoreView::gestureEvent(QGestureEvent *event)
if (value == 1) {
value = pinch->scaleFactor();
}
zoom(magStart*value, pinch->centerPoint());
// Qt 5.4 doesn't report pinch->centerPoint() correctly
QPoint pinchCenterPoint = mapFromGlobal(QPoint(pinch->hotSpot().x(), pinch->hotSpot().y()));
zoom(magStart*value, pinchCenterPoint);
}
}
return true;
Expand Down

0 comments on commit 427c239

Please sign in to comment.