|
|
|
@ -18,17 +18,22 @@ import QGroundControl.SettingsManager 1.0
@@ -18,17 +18,22 @@ import QGroundControl.SettingsManager 1.0
|
|
|
|
|
/// Map scale control |
|
|
|
|
Item { |
|
|
|
|
id: scale |
|
|
|
|
width: zoomButtonsOnLeft || !_zoomButtonsVisible ? rightEnd.x + rightEnd.width : zoomDownButton.x + zoomDownButton.width |
|
|
|
|
width: buttonsOnLeft || !_zoomButtonsVisible ? rightEnd.x + rightEnd.width : zoomDownButton.x + zoomDownButton.width |
|
|
|
|
height: rightEnd.y + rightEnd.height |
|
|
|
|
|
|
|
|
|
property var mapControl ///< Map control for which this scale control is being used |
|
|
|
|
property bool zoomButtonsVisible: true |
|
|
|
|
property bool zoomButtonsOnLeft: true ///< Zoom buttons to left/right of scale bar |
|
|
|
|
property var mapControl ///< Map control for which this scale control is being used |
|
|
|
|
property bool terrainButtonVisible: false |
|
|
|
|
property alias terrainButtonChecked: terrainButton.checked |
|
|
|
|
property bool zoomButtonsVisible: true |
|
|
|
|
property bool buttonsOnLeft: true ///< Buttons to left/right of scale bar |
|
|
|
|
|
|
|
|
|
signal terrainButtonClicked |
|
|
|
|
|
|
|
|
|
property variant _scaleLengthsMeters: [5, 10, 25, 50, 100, 150, 250, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000] |
|
|
|
|
property variant _scaleLengthsFeet: [10, 25, 50, 100, 250, 500, 1000, 2000, 3000, 4000, 5280, 5280*2, 5280*5, 5280*10, 5280*25, 5280*50, 5280*100, 5280*250, 5280*500, 5280*1000] |
|
|
|
|
|
|
|
|
|
property bool _zoomButtonsVisible: zoomButtonsVisible && !ScreenTools.isMobile // Zoom buttons don't show on mobile since finger pinch works fine |
|
|
|
|
property bool _zoomButtonsVisible: zoomButtonsVisible && !ScreenTools.isMobile |
|
|
|
|
property bool _terrainButtonVisible: terrainButtonVisible && !ScreenTools.isMobile |
|
|
|
|
|
|
|
|
|
property var _color: mapControl.isSatelliteMap ? "white" : "black" |
|
|
|
|
|
|
|
|
@ -155,8 +160,8 @@ Item {
@@ -155,8 +160,8 @@ Item {
|
|
|
|
|
Rectangle { |
|
|
|
|
id: leftEnd |
|
|
|
|
anchors.top: scaleText.bottom |
|
|
|
|
anchors.leftMargin: zoomButtonsOnLeft && _zoomButtonsVisible ? ScreenTools.defaultFontPixelWidth / 2 : 0 |
|
|
|
|
anchors.left: zoomButtonsOnLeft && _zoomButtonsVisible ? zoomDownButton.right : parent.left |
|
|
|
|
anchors.leftMargin: buttonsOnLeft && _zoomButtonsVisible ? ScreenTools.defaultFontPixelWidth / 2 : 0 |
|
|
|
|
anchors.left: buttonsOnLeft && _zoomButtonsVisible ? zoomDownButton.right : parent.left |
|
|
|
|
width: 2 |
|
|
|
|
height: ScreenTools.defaultFontPixelHeight |
|
|
|
|
color: _color |
|
|
|
@ -181,11 +186,24 @@ Item {
@@ -181,11 +186,24 @@ Item {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
id: terrainButton |
|
|
|
|
anchors.top: scaleText.top |
|
|
|
|
anchors.bottom: rightEnd.bottom |
|
|
|
|
anchors.leftMargin: buttonsOnLeft ? 0 : ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
|
anchors.left: buttonsOnLeft ? parent.left : rightEnd.right |
|
|
|
|
text: qsTr("T") |
|
|
|
|
width: height |
|
|
|
|
opacity: 0.75 |
|
|
|
|
visible: _terrainButtonVisible |
|
|
|
|
onClicked: terrainButtonClicked() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
id: zoomUpButton |
|
|
|
|
anchors.top: scaleText.top |
|
|
|
|
anchors.bottom: rightEnd.bottom |
|
|
|
|
anchors.leftMargin: zoomButtonsOnLeft ? 0 : ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
|
anchors.left: zoomButtonsOnLeft ? parent.left : rightEnd.right |
|
|
|
|
anchors.leftMargin: terrainButton.visible ? ScreenTools.defaultFontPixelWidth / 2 : 0 |
|
|
|
|
anchors.left: terrainButton.visible ? terrainButton.right : terrainButton.left |
|
|
|
|
text: qsTr("+") |
|
|
|
|
width: height |
|
|
|
|
opacity: 0.75 |
|
|
|
@ -195,11 +213,12 @@ Item {
@@ -195,11 +213,12 @@ Item {
|
|
|
|
|
|
|
|
|
|
QGCButton { |
|
|
|
|
id: zoomDownButton |
|
|
|
|
anchors.top: scaleText.top |
|
|
|
|
anchors.bottom: rightEnd.bottom |
|
|
|
|
anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2 |
|
|
|
|
anchors.left: zoomUpButton.right |
|
|
|
|
text: qsTr("-") |
|
|
|
|
height: zoomUpButton.height |
|
|
|
|
width: zoomUpButton.width |
|
|
|
|
width: height |
|
|
|
|
opacity: 0.75 |
|
|
|
|
visible: _zoomButtonsVisible |
|
|
|
|
onClicked: mapControl.zoomLevel -= 0.5 |
|
|
|
|