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 <simon.hausmann@theqtcompany.com>
This commit is contained in:
parent
86a8bcede0
commit
eac395fed1
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,10 +352,7 @@ Item {
|
|||
MouseArea {
|
||||
onWheel: {
|
||||
if (wheel.modifiers & Qt.ControlModifier) {
|
||||
if (wheel.angleDelta.y > 0)
|
||||
zoomIn();
|
||||
else
|
||||
zoomOut();
|
||||
adjustZoom(wheel.angleDelta.y / 120);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue