Pinch to zoom fix

Amendment to fix for #12434.
This commit is contained in:
Daniel Ramoeller 2022-01-05 15:27:46 +01:00 committed by Stephan Witt
parent 65394e1907
commit 7134ebd793
2 changed files with 7 additions and 1 deletions

View File

@ -1632,8 +1632,11 @@ bool GuiView::event(QEvent * e)
if (gp) {
QPinchGesture *pinch = static_cast<QPinchGesture *>(gp);
QPinchGesture::ChangeFlags changeFlags = pinch->changeFlags();
if (pinch->state() == Qt::GestureStarted) {
initialZoom_ = lyxrc.currentZoom;
}
if (changeFlags & QPinchGesture::ScaleFactorChanged) {
qreal factor = lyxrc.currentZoom*pinch->scaleFactor();
qreal factor = initialZoom_ * pinch->totalScaleFactor();
zoomValueChanged(factor);
}
}

View File

@ -526,6 +526,9 @@ private:
// developer mode
bool devel_mode_;
// initial zoom for pinch gesture
int initialZoom_;
};