summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Martin <notmart@gmail.com>2016-05-13 15:19:48 (GMT)
committerMarco Martin <notmart@gmail.com>2016-05-13 15:19:48 (GMT)
commit1d5853c2cb15dffd045996df83eb10e0815dfec4 (patch)
tree0393ead19f0293ab9200e5ecbb4b23367acf8d78
parent5cc122f0214e0d5e64a73571f83eb57ab7779d4f (diff)
better behavior for wheel zoom
-rw-r--r--mobile/components/DocumentView.qml15
1 files changed, 13 insertions, 2 deletions
diff --git a/mobile/components/DocumentView.qml b/mobile/components/DocumentView.qml
index 148ef05..b7735e2 100644
--- a/mobile/components/DocumentView.qml
+++ b/mobile/components/DocumentView.qml
@@ -155,8 +155,19 @@ QtControls.ScrollView {
}
onWheel: {
if (wheel.modifiers & Qt.ControlModifier) {
- var factor = (wheel.angleDelta.y / 120) * 1.2;
- flick.resizeContent(flick.contentWidth * factor, flick.contentHeight * factor, Qt.point(wheel.x, wheel.y));
+ //generate factors between 0.8 and 1.2
+ var factor = (((wheel.angleDelta.y / 120)+1) / 5 )+ 0.8;
+
+ var newWidth = flick.contentWidth * factor;
+ var newHeight = flick.contentHeight * factor;
+
+ if (newWidth < flick.width || newHeight < flick.height ||
+ newHeight > flick.height * 3) {
+ return;
+ }
+
+ flick.resizeContent(newWidth, newHeight, Qt.point(wheel.x, wheel.y));
+ flick.returnToBounds();
resizeTimer.stop();
} else {
flick.contentY = Math.min(flick.contentHeight-flick.height, Math.max(0, flick.contentY - wheel.angleDelta.y));