diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index 214d09097c2ba5c47b6ab3e952d3be8bfa53ea4b..92bf418a1ab93a2ee8e75d3dcfe78d3fedcf486e 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -48,6 +48,8 @@ FlightMap { property var _activeVehicleCoordinate: activeVehicle ? activeVehicle.coordinate : QtPositioning.coordinate() property real _toolButtonTopMargin: parent.height - mainWindow.height + (ScreenTools.defaultFontPixelHeight / 2) property bool _airspaceEnabled: QGroundControl.airmapSupported ? (QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue && QGroundControl.airspaceManager.connected): false + property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings + property bool _keepMapCenteredOnVehicle: _flyViewSettings.keepMapCenteredOnVehicle.rawValue property bool _disableVehicleTracking: false property bool _keepVehicleCentered: mainIsMap ? false : true @@ -129,7 +131,7 @@ FlightMap { function updateMapToVehiclePosition() { // We let FlightMap handle first vehicle position - if (firstVehiclePositionReceived && _activeVehicleCoordinate.isValid && !_disableVehicleTracking) { + if (!_keepMapCenteredOnVehicle && firstVehiclePositionReceived && _activeVehicleCoordinate.isValid && !_disableVehicleTracking) { if (_keepVehicleCentered) { flightMap.center = _activeVehicleCoordinate } else { @@ -140,6 +142,12 @@ FlightMap { } } + on_ActiveVehicleCoordinateChanged: { + if (_keepMapCenteredOnVehicle && _activeVehicleCoordinate.isValid && !_disableVehicleTracking) { + flightMap.center = _activeVehicleCoordinate + } + } + Timer { id: panRecenterTimer interval: 10000 diff --git a/src/Settings/FlyView.SettingsGroup.json b/src/Settings/FlyView.SettingsGroup.json index 085ed88380da344a230db5fa811249a819e22782..118f6cadccd694055676bb0c23832a95dea493da 100644 --- a/src/Settings/FlyView.SettingsGroup.json +++ b/src/Settings/FlyView.SettingsGroup.json @@ -37,6 +37,12 @@ "type": "bool", "defaultValue": false }, +{ + "name": "keepMapCenteredOnVehicle", + "shortDescription": "Keep map centered on vehicle", + "type": "bool", + "defaultValue": false +}, { "name": "maxGoToLocationDistance", "shortDescription": "Maximum distance allowed for Go To Location.", diff --git a/src/Settings/FlyViewSettings.cc b/src/Settings/FlyViewSettings.cc index 867cf2b68e9b0e7be4ed8d362cc8ad4041057e2e..5099acf01631c72de3c9e51ac5db4077f95f3a68 100644 --- a/src/Settings/FlyViewSettings.cc +++ b/src/Settings/FlyViewSettings.cc @@ -24,3 +24,4 @@ DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel) DECLARE_SETTINGSFACT(FlyViewSettings, showAdditionalIndicatorsCompass) DECLARE_SETTINGSFACT(FlyViewSettings, lockNoseUpCompass) DECLARE_SETTINGSFACT(FlyViewSettings, maxGoToLocationDistance) +DECLARE_SETTINGSFACT(FlyViewSettings, keepMapCenteredOnVehicle) diff --git a/src/Settings/FlyViewSettings.h b/src/Settings/FlyViewSettings.h index 1623406d4786e3d2882376f6b988d0dad5cce823..167a42caae008d22d3b60ce3ff77fc46dfd343ee 100644 --- a/src/Settings/FlyViewSettings.h +++ b/src/Settings/FlyViewSettings.h @@ -26,4 +26,5 @@ public: DEFINE_SETTINGFACT(showAdditionalIndicatorsCompass) DEFINE_SETTINGFACT(lockNoseUpCompass) DEFINE_SETTINGFACT(maxGoToLocationDistance) + DEFINE_SETTINGFACT(keepMapCenteredOnVehicle) }; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 7c7552fc787f289ad1ebc2d7f45e9e7a2404f0e1..4baed9de61e67f8c2a6d3c742ef809127e19a41b 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -468,6 +468,14 @@ Rectangle { property Fact _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist } + FactCheckBox { + text: qsTr("Keep Map Centered On Vehicle") + fact: _keepMapCenteredOnVehicle + visible: _keepMapCenteredOnVehicle.visible + + property Fact _keepMapCenteredOnVehicle: QGroundControl.settingsManager.flyViewSettings.keepMapCenteredOnVehicle + } + FactCheckBox { text: qsTr("Show Telemetry Log Replay Status Bar") fact: _showLogReplayStatusBar