commit 7134ebd7938ee2f2e075d53b83a346b168a622c1
Author: Daniel Ramoeller <[email protected]>
Date: Wed Jan 5 15:27:46 2022 +0100
Pinch to zoom fix
Amendment to fix for #12434.
---
src/frontends/qt/GuiView.cpp | 5 ++++-
src/frontends/qt/GuiView.h | 3 +++
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 6cd97f5..91e8229 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -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);
}
}
diff --git a/src/frontends/qt/GuiView.h b/src/frontends/qt/GuiView.h
index 145a1f2..9ad3610 100644
--- a/src/frontends/qt/GuiView.h
+++ b/src/frontends/qt/GuiView.h
@@ -526,6 +526,9 @@ private:
// developer mode
bool devel_mode_;
+
+ // initial zoom for pinch gesture
+ int initialZoom_;
};
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs