summaryrefslogtreecommitdiff
path: root/src/location/declarativemaps/qdeclarativegeomap.cpp
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-05-02 16:04:13 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-05-03 16:42:26 +0000
commit18f7e6dc9f59159b70cb7e6a8745738f42d4f46f (patch)
tree6e0bf8a54ebeb4bbbd09cba57b673a9e662259e2 /src/location/declarativemaps/qdeclarativegeomap.cpp
parent61bb8c49ec662adf1622cd0bf91de51a2305adb9 (diff)
downloadqtlocation-18f7e6dc9f59159b70cb7e6a8745738f42d4f46f.tar.gz
Fix for MapGestureArea pinch and scroll wheel not honoring min zoom
This patch fixes a regression introduced with e81ba34a98b259723e783e2d2df4321309992291, which made possible to zoom below the minimum valid zoom level for a viewport size. Change-Id: I4e71530b9bc5423ea24083146963c3bd0928f14a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativegeomap.cpp')
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index f196af04..4df884d5 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -942,6 +942,21 @@ qreal QDeclarativeGeoMap::maximumZoomLevel() const
*/
void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel)
{
+ return setZoomLevel(zoomLevel, m_cameraCapabilities.overzoomEnabled());
+}
+
+/*!
+ \internal
+
+ Sets the zoom level.
+ Larger values for the zoom level provide more detail. Zoom levels
+ are always non-negative. The default value is 8.0. Values outside the
+ [minimumZoomLevel, maximumZoomLevel] range, which represent the range for which
+ tiles are available, can be accepted or clamped by setting the overzoom argument
+ to true or false respectively.
+*/
+void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel, bool overzoom)
+{
if (m_cameraData.zoomLevel() == zoomLevel || zoomLevel < 0)
return;
@@ -949,8 +964,9 @@ void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel)
bool centerHasChanged = false;
if (m_initialized) {
- m_cameraData.setZoomLevel(qBound<qreal>(m_cameraCapabilities.overzoomEnabled() ? 0 : minimumZoomLevel(), zoomLevel,
- m_cameraCapabilities.overzoomEnabled() ? 30 : maximumZoomLevel()));
+ m_cameraData.setZoomLevel(qBound<qreal>(overzoom ? m_map->minimumZoom() : minimumZoomLevel(),
+ zoomLevel,
+ overzoom ? 30 : maximumZoomLevel()));
m_maximumViewportLatitude = m_map->maximumCenterLatitudeAtZoom(m_cameraData);
QGeoCoordinate coord = m_cameraData.center();
coord.setLatitude(qBound(-m_maximumViewportLatitude, coord.latitude(), m_maximumViewportLatitude));