From 34ff8eacba855db6527e564a6674a6b554f232bf Mon Sep 17 00:00:00 2001
From: Paolo Angelelli <paolo.angelelli@qt.io>
Date: Tue, 11 Apr 2017 11:43:39 +0200
Subject: [PATCH] MapViewer example: make double clicks zoom to integral zoom
 levels

In this way there's a way to easily get to a zoom level where the map
is sharp

Change-Id: I176cf3870d9c3fe970191d46c804e13daab674fa
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
---
 examples/location/mapviewer/map/MapComponent.qml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/location/mapviewer/map/MapComponent.qml b/examples/location/mapviewer/map/MapComponent.qml
index c450a1505..570505a0f 100644
--- a/examples/location/mapviewer/map/MapComponent.qml
+++ b/examples/location/mapviewer/map/MapComponent.qml
@@ -604,9 +604,9 @@ Map {
             var mouseGeoPos = map.toCoordinate(Qt.point(mouse.x, mouse.y));
             var preZoomPoint = map.fromCoordinate(mouseGeoPos, false);
             if (mouse.button === Qt.LeftButton) {
-                map.zoomLevel++;
+                map.zoomLevel = Math.floor(map.zoomLevel + 1)
             } else if (mouse.button === Qt.RightButton) {
-                map.zoomLevel--;
+                map.zoomLevel = Math.floor(map.zoomLevel - 1)
             }
             var postZoomPoint = map.fromCoordinate(mouseGeoPos, false);
             var dx = postZoomPoint.x - preZoomPoint.x;
-- 
GitLab