diff --git a/examples/location/mapviewer/map/MapComponent.qml b/examples/location/mapviewer/map/MapComponent.qml
index c450a1505a1131f1a7ac8c58bc7d38bea0495bca..570505a0f4c979529523f3bda6f8445089973077 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;