diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index e0fc578..c74abab 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -105,6 +105,7 @@
src/FlightDisplay/FlightDisplayViewVideo.qml
src/FlightDisplay/FlightDisplayViewWidgets.qml
src/FlightDisplay/qmldir
+ src/FlightMap/Widgets/CenterMapDropButton.qml
src/FlightMap/FlightMap.qml
src/FlightMap/Widgets/InstrumentSwipeView.qml
src/FlightMap/MapScale.qml
diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml
index 85faa00..bcc4ee3 100644
--- a/src/FlightDisplay/FlightDisplayView.qml
+++ b/src/FlightDisplay/FlightDisplayView.qml
@@ -116,7 +116,6 @@ QGCView {
onActiveVehicleJoystickEnabledChanged: px4JoystickCheck()
Component.onCompleted: {
- widgetsLoader.source = "FlightDisplayViewWidgets.qml"
setStates()
px4JoystickCheck()
}
@@ -153,9 +152,10 @@ QGCView {
}
]
FlightDisplayViewMap {
- id: _flightMap
- anchors.fill: parent
- flightWidgets: widgetsLoader.item
+ id: _flightMap
+ anchors.fill: parent
+ flightWidgets: flightDisplayViewWidgets
+ rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
}
}
@@ -218,16 +218,13 @@ QGCView {
}
}
- //-- Widgets
- Loader {
- id: widgetsLoader
+ FlightDisplayViewWidgets {
+ id: flightDisplayViewWidgets
z: _panel.z + 4
height: ScreenTools.availableHeight
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
- asynchronous: true
- visible: status == Loader.Ready
property bool isBackgroundDark: root.isBackgroundDark
property var qgcView: root
@@ -242,7 +239,7 @@ QGCView {
visible: QGroundControl.virtualTabletJoystick
anchors.bottom: _flightVideoPipControl.top
anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * 2
- anchors.horizontalCenter: widgetsLoader.horizontalCenter
+ anchors.horizontalCenter: flightDisplayViewWidgets.horizontalCenter
source: "qrc:/qml/VirtualJoystick.qml"
active: QGroundControl.virtualTabletJoystick
diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml
index cce975b..f02f022 100644
--- a/src/FlightDisplay/FlightDisplayViewMap.qml
+++ b/src/FlightDisplay/FlightDisplayViewMap.qml
@@ -29,6 +29,7 @@ FlightMap {
property alias missionController: missionController
property var flightWidgets
+ property var rightPanelWidth
property bool _followVehicle: true
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
@@ -36,6 +37,7 @@ FlightMap {
property var activeVehicleCoordinate: _activeVehicle ? _activeVehicle.coordinate : QtPositioning.coordinate()
property var _gotoHereCoordinate: QtPositioning.coordinate()
property int _retaskSequence: 0
+ property real _toolButtonTopMargin: parent.height - ScreenTools.availableHeight + (ScreenTools.defaultFontPixelHeight / 2)
Component.onCompleted: {
QGroundControl.flightMapPosition = center
@@ -52,6 +54,7 @@ FlightMap {
}
QGCPalette { id: qgcPal; colorGroupEnabled: true }
+ QGCMapPalette { id: mapPal; lightColors: isSatelliteMap }
MissionController {
id: missionController
@@ -68,6 +71,144 @@ FlightMap {
Component.onCompleted: start(false /* editMode */)
}
+ QGCLabel {
+ id: flyLabel
+ text: qsTr("Fly")
+ color: mapPal.text
+ visible: !ScreenTools.isShortScreen
+ anchors.topMargin: _toolButtonTopMargin
+ anchors.horizontalCenter: toolColumn.horizontalCenter
+ anchors.top: parent.top
+ }
+
+ //-- Vertical Tool Buttons
+
+ ExclusiveGroup {
+ id: dropButtonsExclusiveGroup
+ }
+
+ ExclusiveGroup {
+ id: mapTypeButtonsExclusiveGroup
+ }
+
+ //-- Dismiss Drop Down (if any)
+ MouseArea {
+ anchors.fill: parent
+ enabled: dropButtonsExclusiveGroup.current != null
+ onClicked: {
+ if (dropButtonsExclusiveGroup.current) {
+ dropButtonsExclusiveGroup.current.checked = false
+ }
+ dropButtonsExclusiveGroup.current = null
+ }
+ }
+
+ Column {
+ id: toolColumn
+ anchors.topMargin: ScreenTools.isShortScreen ? _toolButtonTopMargin : ScreenTools.defaultFontPixelHeight / 2
+ anchors.leftMargin: ScreenTools.defaultFontPixelHeight
+ anchors.left: parent.left
+ anchors.top: ScreenTools.isShortScreen ? parent.top : flyLabel.bottom
+ spacing: ScreenTools.defaultFontPixelHeight
+ z: QGroundControl.zOrderWidgets
+
+ //-- Map Center Control
+ CenterMapDropButton {
+ id: centerMapDropButton
+ exclusiveGroup: dropButtonsExclusiveGroup
+ map: _flightMap
+ mapFitViewport: Qt.rect(leftToolWidth, _toolButtonTopMargin, flightMap.width - leftToolWidth - rightPanelWidth, flightMap.height - _toolButtonTopMargin)
+ usePlannedHomePosition: false
+ geoFenceController: geoFenceController
+ missionController: missionController
+ rallyPointController: rallyPointController
+ showFollowVehicle: true
+ followVehicle: _followVehicle
+ onFollowVehicleChanged: _followVehicle = followVehicle
+
+ property real leftToolWidth: centerMapDropButton.x + centerMapDropButton.width
+ }
+
+ //-- Map Type Control
+ DropButton {
+ id: mapTypeButton
+ dropDirection: dropRight
+ buttonImage: "/qmlimages/MapType.svg"
+ viewportMargins: ScreenTools.defaultFontPixelWidth / 2
+ exclusiveGroup: dropButtonsExclusiveGroup
+ z: QGroundControl.zOrderWidgets
+ lightBorders: isSatelliteMap
+
+ dropDownComponent: Component {
+ Column {
+ spacing: ScreenTools.defaultFontPixelWidth
+
+ Row {
+ spacing: ScreenTools.defaultFontPixelWidth
+
+ Repeater {
+ model: QGroundControl.flightMapSettings.mapTypes
+
+ QGCButton {
+ checkable: true
+ checked: QGroundControl.flightMapSettings.mapType === text
+ text: modelData
+ width: clearButton.width
+ exclusiveGroup: mapTypeButtonsExclusiveGroup
+
+ onClicked: {
+ QGroundControl.flightMapSettings.mapType = text
+ checked = true
+ dropButtonsExclusiveGroup.current = null
+ }
+ }
+ }
+ }
+
+ QGCButton {
+ id: clearButton
+ text: qsTr("Clear Flight Trails")
+ enabled: QGroundControl.multiVehicleManager.activeVehicle
+ onClicked: {
+ QGroundControl.multiVehicleManager.activeVehicle.clearTrajectoryPoints()
+ dropButtonsExclusiveGroup.current = null
+ }
+ }
+ }
+ }
+ }
+
+ //-- Zoom Map In
+ RoundButton {
+ id: mapZoomPlus
+ visible: !ScreenTools.isTinyScreen && _mainIsMap
+ buttonImage: "/qmlimages/ZoomPlus.svg"
+ exclusiveGroup: dropButtonsExclusiveGroup
+ z: QGroundControl.zOrderWidgets
+ lightBorders: isSatelliteMap
+ onClicked: {
+ if(_flightMap)
+ _flightMap.zoomLevel += 0.5
+ checked = false
+ }
+ }
+
+ //-- Zoom Map Out
+ RoundButton {
+ id: mapZoomMinus
+ visible: !ScreenTools.isTinyScreen && _mainIsMap
+ buttonImage: "/qmlimages/ZoomMinus.svg"
+ exclusiveGroup: dropButtonsExclusiveGroup
+ z: QGroundControl.zOrderWidgets
+ lightBorders: isSatelliteMap
+ onClicked: {
+ if(_flightMap)
+ _flightMap.zoomLevel -= 0.5
+ checked = false
+ }
+ }
+ }
+
// Add trajectory points to the map
MapItemView {
model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0
diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml
index 7492de0..cd46092 100644
--- a/src/FlightDisplay/FlightDisplayViewWidgets.qml
+++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml
@@ -34,7 +34,6 @@ Item {
property bool _useAlternateInstruments: QGroundControl.virtualTabletJoystick || ScreenTools.isTinyScreen
readonly property real _margins: ScreenTools.defaultFontPixelHeight / 2
- readonly property real _toolButtonTopMargin: parent.height - ScreenTools.availableHeight + (ScreenTools.defaultFontPixelHeight / 2)
QGCMapPalette { id: mapPal; lightColors: isBackgroundDark }
QGCPalette { id: qgcPal }
@@ -47,14 +46,6 @@ Item {
return Math.min(w, 200)
}
- ExclusiveGroup {
- id: _dropButtonsExclusiveGroup
- }
-
- ExclusiveGroup {
- id: _mapTypeButtonsExclusiveGroup
- }
-
//-- Map warnings
Column {
anchors.horizontalCenter: parent.horizontalCenter
@@ -80,17 +71,6 @@ Item {
}
}
- //-- Dismiss Drop Down (if any)
- MouseArea {
- anchors.fill: parent
- enabled: _dropButtonsExclusiveGroup.current != null
- onClicked: {
- if(_dropButtonsExclusiveGroup.current)
- _dropButtonsExclusiveGroup.current.checked = false
- _dropButtonsExclusiveGroup.current = null
- }
- }
-
//-- Instrument Panel
QGCInstrumentWidget {
id: instrumentGadget
@@ -139,149 +119,6 @@ Item {
maxHeight: virtualJoystickMultiTouch.visible ? virtualJoystickMultiTouch.y - y : parent.height - anchors.margins - y
}
- QGCLabel {
- id: flyLabel
- text: qsTr("Fly")
- color: mapPal.text
- visible: !ScreenTools.isShortScreen && _mainIsMap
- anchors.topMargin: _toolButtonTopMargin
- anchors.horizontalCenter: toolColumn.horizontalCenter
- anchors.top: parent.top
- }
-
- //-- Vertical Tool Buttons
- Column {
- id: toolColumn
- anchors.topMargin: ScreenTools.isShortScreen ? _toolButtonTopMargin : ScreenTools.defaultFontPixelHeight / 2
- anchors.leftMargin: ScreenTools.defaultFontPixelHeight
- anchors.left: parent.left
- anchors.top: ScreenTools.isShortScreen ? parent.top : flyLabel.bottom
- spacing: ScreenTools.defaultFontPixelHeight
- visible: _mainIsMap
-
- //-- Map Center Control
- DropButton {
- id: centerMapDropButton
- dropDirection: dropRight
- buttonImage: "/qmlimages/MapCenter.svg"
- viewportMargins: ScreenTools.defaultFontPixelWidth / 2
- exclusiveGroup: _dropButtonsExclusiveGroup
- z: QGroundControl.zOrderWidgets
- lightBorders: _lightWidgetBorders
-
- dropDownComponent: Component {
- Row {
- spacing: ScreenTools.defaultFontPixelWidth
-
- QGCCheckBox {
- id: followVehicleCheckBox
- text: qsTr("Follow Vehicle")
- checked: _flightMap ? _flightMap._followVehicle : false
- anchors.verticalCenter: parent.verticalCenter
- //anchors.baseline: centerMapButton.baseline - This doesn't work correctly on mobile for some strange reason, so we center instead
-
- onClicked: {
- _dropButtonsExclusiveGroup.current = null
- _flightMap._followVehicle = !_flightMap._followVehicle
- }
- }
-
- QGCButton {
- id: centerMapButton
- text: qsTr("Center map on Vehicle")
- enabled: _activeVehicle && !followVehicleCheckBox.checked
-
- property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
-
- onClicked: {
- _dropButtonsExclusiveGroup.current = null
- _flightMap.center = activeVehicle.coordinate
- }
- }
- }
- }
- }
-
- //-- Map Type Control
- DropButton {
- id: mapTypeButton
- dropDirection: dropRight
- buttonImage: "/qmlimages/MapType.svg"
- viewportMargins: ScreenTools.defaultFontPixelWidth / 2
- exclusiveGroup: _dropButtonsExclusiveGroup
- z: QGroundControl.zOrderWidgets
- lightBorders: _lightWidgetBorders
-
- dropDownComponent: Component {
- Column {
- spacing: ScreenTools.defaultFontPixelWidth
-
- Row {
- spacing: ScreenTools.defaultFontPixelWidth
-
- Repeater {
- model: QGroundControl.flightMapSettings.mapTypes
-
- QGCButton {
- checkable: true
- checked: QGroundControl.flightMapSettings.mapType === text
- text: modelData
- width: clearButton.width
- exclusiveGroup: _mapTypeButtonsExclusiveGroup
-
- onClicked: {
- QGroundControl.flightMapSettings.mapType = text
- checked = true
- _dropButtonsExclusiveGroup.current = null
- }
- }
- }
- }
-
- QGCButton {
- id: clearButton
- text: qsTr("Clear Flight Trails")
- enabled: QGroundControl.multiVehicleManager.activeVehicle
- onClicked: {
- QGroundControl.multiVehicleManager.activeVehicle.clearTrajectoryPoints()
- _dropButtonsExclusiveGroup.current = null
- }
- }
- }
- }
- }
-
- //-- Zoom Map In
- RoundButton {
- id: mapZoomPlus
- visible: !ScreenTools.isTinyScreen && _mainIsMap
- buttonImage: "/qmlimages/ZoomPlus.svg"
- exclusiveGroup: _dropButtonsExclusiveGroup
- z: QGroundControl.zOrderWidgets
- lightBorders: _lightWidgetBorders
- onClicked: {
- if(_flightMap)
- _flightMap.zoomLevel += 0.5
- checked = false
- }
- }
-
- //-- Zoom Map Out
- RoundButton {
- id: mapZoomMinus
- visible: !ScreenTools.isTinyScreen && _mainIsMap
- buttonImage: "/qmlimages/ZoomMinus.svg"
- exclusiveGroup: _dropButtonsExclusiveGroup
- z: QGroundControl.zOrderWidgets
- lightBorders: _lightWidgetBorders
- onClicked: {
- if(_flightMap)
- _flightMap.zoomLevel -= 0.5
- checked = false
- }
- }
- }
-
//-- Guided mode buttons
Rectangle {
id: _guidedModeBar
diff --git a/src/FlightDisplay/qmldir b/src/FlightDisplay/qmldir
index b1bf782..ccd5c34 100644
--- a/src/FlightDisplay/qmldir
+++ b/src/FlightDisplay/qmldir
@@ -1,6 +1,7 @@
Module QGroundControl.FlightDisplay
-FlightDisplayView 1.0 FlightDisplayView.qml
-FlightDisplayViewMap 1.0 FlightDisplayViewMap.qml
-FlightDisplayViewVideo 1.0 FlightDisplayViewVideo.qml
+FlightDisplayView 1.0 FlightDisplayView.qml
+FlightDisplayViewMap 1.0 FlightDisplayViewMap.qml
+FlightDisplayViewVideo 1.0 FlightDisplayViewVideo.qml
+FlightDisplayViewWidgets 1.0 FlightDisplayViewWidgets.qml
diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml
index 96018f1..8d9830e 100644
--- a/src/FlightMap/FlightMap.qml
+++ b/src/FlightMap/FlightMap.qml
@@ -82,6 +82,14 @@ Map {
scaleText.text = text
}
+ function setVisibleRegion(region) {
+ // 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.
+ _map.visibleRegion = QtPositioning.rectangle(QtPositioning.coordinate(0, 0), QtPositioning.coordinate(0, 0))
+ _map.visibleRegion = region
+ }
+
zoomLevel: 18
center: QGroundControl.lastKnownHomePosition
gesture.flickDeceleration: 3000
diff --git a/src/FlightMap/Widgets/CenterMapDropButton.qml b/src/FlightMap/Widgets/CenterMapDropButton.qml
new file mode 100644
index 0000000..9fb5883
--- /dev/null
+++ b/src/FlightMap/Widgets/CenterMapDropButton.qml
@@ -0,0 +1,235 @@
+/****************************************************************************
+ *
+ * (c) 2009-2016 QGROUNDCONTROL PROJECT
+ *
+ * QGroundControl is licensed according to the terms in the file
+ * COPYING.md in the root of the source code directory.
+ *
+ ****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Controls 1.3
+import QtQuick.Layouts 1.2
+import QtPositioning 5.3
+
+import QGroundControl 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.Palette 1.0
+
+DropButton {
+ id: dropButton
+ dropDirection: dropRight
+ buttonImage: "/qmlimages/MapCenter.svg"
+ viewportMargins: ScreenTools.defaultFontPixelWidth / 2
+ lightBorders: map.isSatelliteMap
+
+ property var map
+ property rect mapFitViewport
+ property bool usePlannedHomePosition ///< true: planned home position used for calculations, false: vehicle home position use for calculations
+ property var geoFenceController
+ property var missionController
+ property var rallyPointController
+ property bool showMission: true
+ property bool showAllItems: true
+ property bool showFollowVehicle: false
+ property bool followVehicle: false
+
+ property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
+
+ function fitHomePosition() {
+ var homePosition = QtPositioning.coordinate()
+ var activeVehicle = QGroundControl.multiVehicleManager.activeVehicle
+ if (usePlannedHomePosition) {
+ homePosition = missionController.visualItems.get(0).coordinate
+ } else if (activeVehicle) {
+ homePosition = activeVehicle.homePosition
+ }
+ return homePosition
+ }
+
+ /// Normalize latitude to range: 0 to 180, S to N
+ function normalizeLat(lat) {
+ return lat + 90.0
+ }
+
+ /// Normalize longitude to range: 0 to 360, W to E
+ function normalizeLon(lon) {
+ return lon + 180.0
+ }
+
+ /// Fits the visible region of the map to inclues all of the specified coordinates. If no coordinates
+ /// are specified the map will center to fitHomePosition()
+ function fitMapViewportToAllCoordinates(coordList) {
+ if (coordList.length == 0) {
+ map.center = fitHomePosition()
+ return
+ }
+
+ // Create the normalized lat/lon corners for the coordinate bounding rect from the list of coordinates
+ var north = normalizeLat(coordList[0].latitude)
+ var south = north
+ var east = normalizeLon(coordList[0].longitude)
+ var west = east
+ for (var i=1; i 2) {
+ for (var i=0; i 2) {
- for (var i=0; i
+ *
+ * QGroundControl is licensed according to the terms in the file
+ * COPYING.md in the root of the source code directory.
+ *
+ ****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 1.2
import QGroundControl.Palette 1.0
import QGroundControl.ScreenTools 1.0
-Rectangle
-{
- id: __mapButton
-
- property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
- property bool __showHighlight: (__pressed | __hovered | checked) && !__forceHoverOff
-
- property bool __forceHoverOff: false
- property int __lastGlobalMouseX: 0
- property int __lastGlobalMouseY: 0
- property bool __pressed: false
- property bool __hovered: false
+Rectangle {
+ id: mapButton
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button
+ border.width: _showBorder ? 1: 0
+ border.color: qgcPal.buttonText
property bool checked: false
property bool complete: false
@@ -23,25 +26,34 @@ Rectangle
property int tiles: 0
property string size: ""
+ property bool _showHighlight: (_pressed | _hovered | checked) && !_forceHoverOff
+ property bool _showBorder: qgcPal.globalTheme === QGCPalette.Light
+
+ property bool _forceHoverOff: false
+ property int _lastGlobalMouseX: 0
+ property int _lastGlobalMouseY: 0
+ property bool _pressed: false
+ property bool _hovered: false
+
signal clicked()
- color: __showHighlight ? __qgcPal.buttonHighlight : __qgcPal.button
- anchors.margins: ScreenTools.defaultFontPixelWidth
+ QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
+
Row {
anchors.centerIn: parent
QGCLabel {
id: nameLabel
- width: __mapButton.width * 0.4
- color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText
+ width: mapButton.width * 0.4
+ color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
anchors.verticalCenter: parent.verticalCenter
}
QGCLabel {
id: sizeLabel
- width: __mapButton.width * 0.4
+ width: mapButton.width * 0.4
horizontalAlignment: Text.AlignRight
anchors.verticalCenter: parent.verticalCenter
- color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText
- text: __mapButton.size + (tiles > 0 ? " (" + tiles + " tiles)" : "")
+ color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
+ text: mapButton.size + (tiles > 0 ? " (" + tiles + " tiles)" : "")
}
Item {
width: ScreenTools.defaultFontPixelWidth * 2
@@ -66,7 +78,7 @@ Rectangle
source: "/res/buttonRight.svg"
mipmap: true
fillMode: Image.PreserveAspectFit
- color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText
+ color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
anchors.verticalCenter: parent.verticalCenter
}
}
@@ -75,20 +87,18 @@ Rectangle
anchors.fill: parent
hoverEnabled: true
onMouseXChanged: {
- __lastGlobalMouseX = ScreenTools.mouseX()
- __lastGlobalMouseY = ScreenTools.mouseY()
+ _lastGlobalMouseX = ScreenTools.mouseX()
+ _lastGlobalMouseY = ScreenTools.mouseY()
}
onMouseYChanged: {
- __lastGlobalMouseX = ScreenTools.mouseX()
- __lastGlobalMouseY = ScreenTools.mouseY()
- }
- onEntered: { __hovered = true; __forceHoverOff = false; hoverTimer.start() }
- onExited: { __hovered = false; __forceHoverOff = false; hoverTimer.stop() }
- onPressed: { __pressed = true; }
- onReleased: { __pressed = false; }
- onClicked: {
- __mapButton.clicked()
+ _lastGlobalMouseX = ScreenTools.mouseX()
+ _lastGlobalMouseY = ScreenTools.mouseY()
}
+ onEntered: { _hovered = true; _forceHoverOff = false; hoverTimer.start() }
+ onExited: { _hovered = false; _forceHoverOff = false; hoverTimer.stop() }
+ onPressed: { _pressed = true; }
+ onReleased: { _pressed = false; }
+ onClicked: mapButton.clicked()
}
Timer {
@@ -96,10 +106,10 @@ Rectangle
interval: 250
repeat: true
onTriggered: {
- if (__lastGlobalMouseX !== ScreenTools.mouseX() || __lastGlobalMouseY !== ScreenTools.mouseY()) {
- __forceHoverOff = true
+ if (_lastGlobalMouseX !== ScreenTools.mouseX() || _lastGlobalMouseY !== ScreenTools.mouseY()) {
+ _forceHoverOff = true
} else {
- __forceHoverOff = false
+ _forceHoverOff = false
}
}
}
diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml
index a80510e..450a510 100644
--- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml
+++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml
@@ -7,7 +7,6 @@
*
****************************************************************************/
-
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
@@ -38,6 +37,7 @@ QGCView {
property string savedMapType: ""
property bool _showPreview: true
property bool _defaultSet: offlineMapView && offlineMapView._currentSelection && offlineMapView._currentSelection.defaultSet
+ property real _margins: ScreenTools.defaultFontPixelWidth /2
property bool _saveRealEstate: ScreenTools.isTinyScreen || ScreenTools.isShortScreen
property real _adjustableFontPointSize: _saveRealEstate ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize
@@ -327,6 +327,17 @@ QGCView {
anchors.fill: parent
}
+ CenterMapDropButton {
+ anchors.margins: _margins
+ anchors.left: parent.left
+ anchors.top: parent.top
+ map: _map
+ z: QGroundControl.zOrderTopMost
+ showMission: false
+ showAllItems: false
+ visible: addNewSetView.visible
+ }
+
MapScale {
anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2
anchors.bottomMargin: anchors.leftMargin
@@ -475,97 +486,91 @@ QGCView {
anchors.fill: parent
visible: false
- Map {
- id: minZoomPreview
- anchors.leftMargin: ScreenTools.defaultFontPixelWidth /2
- anchors.topMargin: anchors.leftMargin
- anchors.top: parent.top
- anchors.left: parent.left
- width: parent.width / 4
- height: parent.height / 4
- center: _map.center
- activeMapType: _map.activeMapType
- zoomLevel: sliderMinZoom.value
- gesture.enabled: false
- visible: _showPreview
-
- property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1
-
- plugin: Plugin { name: "QGroundControl" }
-
- MapScale {
- anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2
- anchors.bottomMargin: anchors.leftMargin
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- mapControl: parent
+ Column {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: _margins
+ anchors.left: parent.left
+ spacing: _margins
+
+ QGCButton {
+ text: "Show zoom previews"
+ visible: !_showPreview
+ onClicked: _showPreview = !_showPreview
}
- }
- Map {
- id: maxZoomPreview
- anchors.topMargin: minZoomPreview.anchors.topMargin
- anchors.left: minZoomPreview.left
- anchors.top: minZoomPreview.bottom
- width: minZoomPreview.width
- height: minZoomPreview.height
- center: _map.center
- activeMapType: _map.activeMapType
- zoomLevel: sliderMaxZoom.value
- gesture.enabled: false
- visible: _showPreview
-
- property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1
-
- plugin: Plugin { name: "QGroundControl" }
-
- MapScale {
- anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2
- anchors.bottomMargin: anchors.leftMargin
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- mapControl: parent
- }
- }
+ Map {
+ id: minZoomPreview
+ width: addNewSetView.width / 4
+ height: addNewSetView.height / 4
+ center: _map.center
+ activeMapType: _map.activeMapType
+ zoomLevel: sliderMinZoom.value
+ gesture.enabled: false
+ visible: _showPreview
+
+ plugin: Plugin { name: "QGroundControl" }
+
+ MapScale {
+ anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2
+ anchors.bottomMargin: anchors.leftMargin
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ mapControl: parent
+ }
- Rectangle {
- anchors.fill: minZoomPreview
- border.color: _mapAdjustedColor
- color: "transparent"
- visible: _showPreview
- QGCLabel {
- anchors.centerIn: parent
- color: _mapAdjustedColor
- text: qsTr("Min Zoom: %1").arg(sliderMinZoom.value)
- }
- MouseArea {
- anchors.fill: parent
- onClicked: _showPreview = false
- }
- }
+ Rectangle {
+ anchors.fill: parent
+ border.color: _mapAdjustedColor
+ color: "transparent"
- Rectangle {
- anchors.fill: maxZoomPreview
- border.color: _mapAdjustedColor
- color: "transparent"
- visible: _showPreview
- QGCLabel {
- anchors.centerIn: parent
- color: _mapAdjustedColor
- text: qsTr("Max Zoom: %1").arg(sliderMaxZoom.value)
- }
- MouseArea {
- anchors.fill: parent
- onClicked: _showPreview = false
- }
- }
+ QGCLabel {
+ anchors.centerIn: parent
+ color: _mapAdjustedColor
+ text: qsTr("Min Zoom: %1").arg(sliderMinZoom.value)
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: _showPreview = false
+ }
+ }
+ } // Map
+
+ Map {
+ id: maxZoomPreview
+ width: minZoomPreview.width
+ height: minZoomPreview.height
+ center: _map.center
+ activeMapType: _map.activeMapType
+ zoomLevel: sliderMaxZoom.value
+ gesture.enabled: false
+ visible: _showPreview
+
+ plugin: Plugin { name: "QGroundControl" }
+
+ MapScale {
+ anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2
+ anchors.bottomMargin: anchors.leftMargin
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ mapControl: parent
+ }
- QGCButton {
- anchors.left: minZoomPreview.left
- anchors.top: minZoomPreview.top
- text: "Show zoom previews"
- visible: !_showPreview
- onClicked: _showPreview = !_showPreview
+ Rectangle {
+ anchors.fill: parent
+ border.color: _mapAdjustedColor
+ color: "transparent"
+
+ QGCLabel {
+ anchors.centerIn: parent
+ color: _mapAdjustedColor
+ text: qsTr("Max Zoom: %1").arg(sliderMaxZoom.value)
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: _showPreview = false
+ }
+ }
+ } // Map
}
//-- Add new set dialog
@@ -574,7 +579,7 @@ QGCView {
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
width: ScreenTools.defaultFontPixelWidth * 24
- height: Math.min(parent.height - (anchors.margins * 2), addNewSetFlickable.y + addNewSetColumn.height + ScreenTools.defaultFontPixelHeight)
+ height: Math.min(parent.height - (anchors.margins * 2), addNewSetFlickable.y + addNewSetColumn.height + addNewSetLabel.anchors.margins)
color: Qt.rgba(qgcPal.window.r, qgcPal.window.g, qgcPal.window.b, 0.85)
radius: ScreenTools.defaultFontPixelWidth * 0.5