From eac395fed121d09e39abcb322c508aa49c467074 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 30 Nov 2015 16:21:58 +0100 Subject: Update examples to deal correctly with fine-grained wheel events Zooming in large steps on every wheel-events breaks with fine-grained wheel events like we get on touch-pads. We should therefore not encourage that in our examples. Change-Id: Ie2e70b91c66c73f12ef1f6cd55c8610ae70b36ed Reviewed-by: Simon Hausmann --- examples/quick/mousearea/mousearea-wheel-example.qml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/quick/mousearea/mousearea-wheel-example.qml b/examples/quick/mousearea/mousearea-wheel-example.qml index ca6518ec4b..861639811c 100644 --- a/examples/quick/mousearea/mousearea-wheel-example.qml +++ b/examples/quick/mousearea/mousearea-wheel-example.qml @@ -64,10 +64,9 @@ Rectangle { anchors.fill: parent onWheel: { if (wheel.modifiers & Qt.ControlModifier) { - if (wheel.angleDelta.y > 0) - parent.scaleFactor += 0.2; - else if (parent.scaleFactor - 0.2 >= 0.2) - parent.scaleFactor -= 0.2; + parent.scaleFactor += 0.2 * wheel.angleDelta.y / 120; + if (parent.scaleFactor < 0) + parent.scaleFactor = 0; } } } -- cgit v1.2.3