Commit d28bafba authored by Gus Grubba's avatar Gus Grubba

Double click to delete a vertex

parent 79f54537
...@@ -29,6 +29,7 @@ Rectangle { ...@@ -29,6 +29,7 @@ Rectangle {
property var itemCoordinate ///< Coordinate we are updating during drag property var itemCoordinate ///< Coordinate we are updating during drag
signal clicked signal clicked
signal doubleClicked
signal dragStart signal dragStart
signal dragStop signal dragStop
...@@ -76,6 +77,11 @@ Rectangle { ...@@ -76,6 +77,11 @@ Rectangle {
itemDragger.clicked() itemDragger.clicked()
} }
onDoubleClicked: {
focus = true
itemDragger.doubleClicked()
}
property bool dragActive: drag.active property bool dragActive: drag.active
onDragActiveChanged: { onDragActiveChanged: {
if (dragActive) { if (dragActive) {
......
...@@ -291,7 +291,7 @@ Item { ...@@ -291,7 +291,7 @@ Item {
} }
} }
onClicked: mapPolygon.removeVertex(polygonVertex) onDoubleClicked: mapPolygon.removeVertex(polygonVertex)
} }
} }
......
...@@ -128,10 +128,10 @@ Item { ...@@ -128,10 +128,10 @@ Item {
Menu { Menu {
id: menu id: menu
property int removeVertex property int removeVertex
MenuItem { MenuItem {
id: removeVertexItem
text: qsTr("Remove vertex" ) text: qsTr("Remove vertex" )
onTriggered: mapPolyline.removeVertex(parent.removeVertex) onTriggered: mapPolyline.removeVertex(parent.removeVertex)
} }
...@@ -140,6 +140,10 @@ Item { ...@@ -140,6 +140,10 @@ Item {
text: qsTr("Load KML...") text: qsTr("Load KML...")
onTriggered: kmlLoadDialog.openForLoad() onTriggered: kmlLoadDialog.openForLoad()
} }
function resetMenu() {
removeVertexItem.visible = mapPolyline.count > 2
}
} }
Component { Component {
...@@ -243,10 +247,13 @@ Item { ...@@ -243,10 +247,13 @@ Item {
} }
onClicked: { onClicked: {
if (polylineVertex == 0) { menu.resetMenu()
menu.removeVertex = polylineVertex menu.removeVertex = polylineVertex
menu.popup() menu.popup()
} else { }
onDoubleClicked: {
if (polylineVertex != 0) {
mapPolyline.removeVertex(polylineVertex) mapPolyline.removeVertex(polylineVertex)
} }
} }
...@@ -271,15 +278,7 @@ Item { ...@@ -271,15 +278,7 @@ Item {
height: width height: width
radius: width / 2 radius: width / 2
color: "white" color: "white"
opacity: .90 opacity: 0.9
QGCLabel {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
text: "..."
color: "black"
visible: polylineVertex == 0
}
} }
} }
} }
......
...@@ -106,11 +106,11 @@ Rectangle { ...@@ -106,11 +106,11 @@ Rectangle {
QGCCheckBox { QGCCheckBox {
id: relAlt id: relAlt
anchors.left: parent.left
text: qsTr("Relative altitude") text: qsTr("Relative altitude")
checked: missionItem.cameraCalc.distanceToSurfaceRelative checked: missionItem.cameraCalc.distanceToSurfaceRelative
enabled: missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain enabled: missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain
visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain) visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain)
Layout.alignment: Qt.AlignLeft
Layout.columnSpan: 2 Layout.columnSpan: 2
onClicked: missionItem.cameraCalc.distanceToSurfaceRelative = checked onClicked: missionItem.cameraCalc.distanceToSurfaceRelative = checked
...@@ -146,8 +146,7 @@ Rectangle { ...@@ -146,8 +146,7 @@ Rectangle {
} }
GridLayout { GridLayout {
anchors.left: parent.left Layout.fillWidth: true
anchors.right: parent.right
columnSpacing: _margin columnSpacing: _margin
rowSpacing: _margin rowSpacing: _margin
columns: 2 columns: 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment