Commit 34ff8eac authored by Paolo Angelelli's avatar Paolo Angelelli
Browse files

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: default avatarAlex Blasche <alexander.blasche@qt.io>
Showing with 2 additions and 2 deletions
...@@ -604,9 +604,9 @@ Map { ...@@ -604,9 +604,9 @@ Map {
var mouseGeoPos = map.toCoordinate(Qt.point(mouse.x, mouse.y)); var mouseGeoPos = map.toCoordinate(Qt.point(mouse.x, mouse.y));
var preZoomPoint = map.fromCoordinate(mouseGeoPos, false); var preZoomPoint = map.fromCoordinate(mouseGeoPos, false);
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
map.zoomLevel++; map.zoomLevel = Math.floor(map.zoomLevel + 1)
} else if (mouse.button === Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
map.zoomLevel--; map.zoomLevel = Math.floor(map.zoomLevel - 1)
} }
var postZoomPoint = map.fromCoordinate(mouseGeoPos, false); var postZoomPoint = map.fromCoordinate(mouseGeoPos, false);
var dx = postZoomPoint.x - preZoomPoint.x; var dx = postZoomPoint.x - preZoomPoint.x;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment