diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-04-07 13:40:19 +0200 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-04-12 13:30:59 +0000 |
commit | e81ba34a98b259723e783e2d2df4321309992291 (patch) | |
tree | 4b8263cf08657d31fbfc7fed40b8824a91c24d52 /src/location/declarativemaps/qquickgeomapgesturearea.cpp | |
parent | 15ceb0279c46e286116a93b61f442de0105fcd0c (diff) |
Allow overzooming when setting zoomLevel directly in a Map
This patch moves the lower/upper bound check on setZoom from
QDeclarativeGeoMap to the gesture area, allowing to set higher zoom
levels than the maximumZoomLevel when setting Map.zoomLevel directly,
for the map types that support overzoom.
This is now safe as the bound check is introduced in the tile fetcher,
so no invalid tiles will be requested, and is beneficial when
combining layers supporting different maximum zoom levels.
Change-Id: I08ee9c282ee2ebc1dafa3c68a238b93ffbc1ba02
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qquickgeomapgesturearea.cpp')
-rw-r--r-- | src/location/declarativemaps/qquickgeomapgesturearea.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/location/declarativemaps/qquickgeomapgesturearea.cpp b/src/location/declarativemaps/qquickgeomapgesturearea.cpp index 3511226c..992fa21e 100644 --- a/src/location/declarativemaps/qquickgeomapgesturearea.cpp +++ b/src/location/declarativemaps/qquickgeomapgesturearea.cpp @@ -949,7 +949,8 @@ void QQuickGeoMapGestureArea::handleWheelEvent(QWheelEvent *event) const QPointF &preZoomPoint = event->posF(); const double zoomLevelDelta = event->angleDelta().y() * qreal(0.001); - m_declarativeMap->setZoomLevel(m_declarativeMap->zoomLevel() + zoomLevelDelta); + // Gesture area should always honor maxZL, but Map might not. + m_declarativeMap->setZoomLevel(qMin<qreal>(m_declarativeMap->zoomLevel() + zoomLevelDelta, maximumZoomLevel())); const QPointF &postZoomPoint = m_map->geoProjection().coordinateToItemPosition(wheelGeoPos, false).toPointF(); if (preZoomPoint != postZoomPoint) // need to re-anchor the wheel geoPos to the event position @@ -1590,7 +1591,7 @@ void QQuickGeoMapGestureArea::updatePinch() qreal perPinchMinimumZoomLevel = qMax(m_pinch.m_zoom.m_start - m_pinch.m_zoom.maximumChange, m_pinch.m_zoom.m_minimum); qreal perPinchMaximumZoomLevel = qMin(m_pinch.m_zoom.m_start + m_pinch.m_zoom.maximumChange, m_pinch.m_zoom.m_maximum); newZoomLevel = qMin(qMax(perPinchMinimumZoomLevel, newZoomLevel), perPinchMaximumZoomLevel); - m_declarativeMap->setZoomLevel(newZoomLevel); + m_declarativeMap->setZoomLevel(qMin<qreal>(newZoomLevel, maximumZoomLevel())); m_pinch.m_zoom.m_previous = newZoomLevel; } } |