diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index 24996792613e782f92e0d7e4aa11316e1d35849e..d278e8b530ebbdae5838707b2e98841975d8e859 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -44,8 +44,12 @@ FlightMap { property bool _activeVehicleCoordinateValid: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.coordinateValid : false property var activeVehicleCoordinate: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.coordinate : QtPositioning.coordinate() - Component.onCompleted: QGroundControl.flightMapPosition = center + Component.onCompleted: { + QGroundControl.flightMapPosition = center + QGroundControl.flightMapZoom = zoomLevel + } onCenterChanged: QGroundControl.flightMapPosition = center + onZoomLevelChanged: QGroundControl.flightMapZoom = zoomLevel onActiveVehicleCoordinateChanged: { if (_followVehicle && _activeVehicleCoordinateValid && activeVehicleCoordinate.isValid) { diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index de35f4963127cd228f0c8ebadc30eaf9a591dbd6..77234f5ca80cf83cfd52a81a84c31c23c3b3da4a 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -76,8 +76,9 @@ public: Q_PROPERTY(Fact* offlineEditingFirmwareType READ offlineEditingFirmwareType CONSTANT) - Q_PROPERTY(QGeoCoordinate lastKnownHomePosition READ lastKnownHomePosition CONSTANT) - Q_PROPERTY(QGeoCoordinate flightMapPosition MEMBER _flightMapPosition NOTIFY flightMapPositionChanged) + Q_PROPERTY(QGeoCoordinate lastKnownHomePosition READ lastKnownHomePosition CONSTANT) + Q_PROPERTY(QGeoCoordinate flightMapPosition MEMBER _flightMapPosition NOTIFY flightMapPositionChanged) + Q_PROPERTY(int flightMapZoom MEMBER _flightMapZoom NOTIFY flightMapZoomChanged) /// @ return: true: experimental survey ip code is turned on Q_PROPERTY(bool experimentalSurvey READ experimentalSurvey WRITE setExperimentalSurvey NOTIFY experimentalSurveyChanged) @@ -152,6 +153,7 @@ signals: void isVersionCheckEnabledChanged (bool enabled); void mavlinkSystemIDChanged (int id); void flightMapPositionChanged (QGeoCoordinate flightMapPosition); + void flightMapZoomChanged (int flightMapZoom); void experimentalSurveyChanged (bool experimentalSurvey); private: @@ -160,11 +162,12 @@ private: LinkManager* _linkManager; MissionCommands* _missionCommands; MultiVehicleManager* _multiVehicleManager; - QGCMapEngineManager* _mapEngineManager; + QGCMapEngineManager* _mapEngineManager; bool _virtualTabletJoystick; - QGeoCoordinate _flightMapPosition; + QGeoCoordinate _flightMapPosition; + int _flightMapZoom; SettingsFact _offlineEditingFirmwareTypeFact; FactMetaData _offlineEditingFirmwareTypeMetaData;