summaryrefslogtreecommitdiff
path: root/examples/location
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-04-11 11:43:39 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-04-11 15:39:44 +0000
commit34ff8eacba855db6527e564a6674a6b554f232bf (patch)
treeb980c7eb9dfc24ca53543c3ae79244487deda200 /examples/location
parent594175be357562561f04f5be83a68f2c6c8165c2 (diff)
downloadqtlocation-34ff8eacba855db6527e564a6674a6b554f232bf.tar.gz
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>
Diffstat (limited to 'examples/location')
-rw-r--r--examples/location/mapviewer/map/MapComponent.qml4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/location/mapviewer/map/MapComponent.qml b/examples/location/mapviewer/map/MapComponent.qml
index c450a150..570505a0 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;