From d21d403449dd7693730053f0692e0bbf5884c694 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Wed, 2 Jul 2025 09:05:15 -0700 Subject: [PATCH] Allow manual zoom level adjust to increase unbounded This allows you to go past where tiles exists but mirrors how 4.4 works. It allows you to go as far as possible zoomed in. --- src/FlightMap/FlightMap.qml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index 7cae7d31db2f..c235d265c5ac 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -39,8 +39,6 @@ Map { property bool firstVehiclePositionReceived: false ///< true: first vehicle position update was responded to property bool planView: false ///< true: map being using for Plan view, items should be draggable - readonly property real maxZoomLevel: 20 - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate() @@ -49,6 +47,7 @@ Map { // This works around a bug on Qt where if you set a visibleRegion and then the user moves or zooms the map // and then you set the same visibleRegion the map will not move/scale appropriately since it thinks there // is nothing to do. + let maxZoomLevel = 20 _map.visibleRegion = QtPositioning.rectangle(QtPositioning.coordinate(0, 0), QtPositioning.coordinate(0, 0)) _map.visibleRegion = region if (_map.zoomLevel > maxZoomLevel) { @@ -135,7 +134,7 @@ Map { } } onScaleChanged: (delta) => { - let newZoomLevel = Math.min(Math.max(_map.zoomLevel + Math.log2(delta), 0), maxZoomLevel) + let newZoomLevel = Math.max(_map.zoomLevel + Math.log2(delta), 0) _map.zoomLevel = newZoomLevel _map.alignCoordinateToPoint(pinchStartCentroid, pinchHandler.centroid.position) } @@ -152,11 +151,6 @@ Map { } - BoundaryRule on zoomLevel { - minimum: 0 - maximum: maxZoomLevel - } - // We specifically do not use a DragHandler for panning. It just causes too many problems if you overlay anything else like a Flickable above it. // Causes all sorts of crazy problems where dragging/scrolling no longerr works on items above in the hierarchy. // Since we are using a MouseArea we also can't use TapHandler for clicks. So we handle that here as well.