diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index 076641a91b8d06422e034eb9fc71bfcb68f9d0f5..75a5b2a374fb809b4c194cfc91d9356abd315176 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -244,10 +244,11 @@ Map { "import QtQuick 2.5; " + "import QtLocation 5.3; " + "import QGroundControl.ScreenTools 1.0; " + + "" + "Rectangle {" + " id: vertexDrag; " + - " width: _sideLength; " + - " height: _sideLength; " + + " width: _sideLength + _expandMargin; " + + " height: _sideLength + _expandMargin; " + " color: 'red'; " + "" + " property var coordinate; " + @@ -256,27 +257,27 @@ Map { " readonly property real _sideLength: ScreenTools.defaultFontPixelWidth * 2; " + " readonly property real _halfSideLength: _sideLength / 2; " + "" + + " property real _expandMargin: ScreenTools.isMobile ? ScreenTools.defaultFontPixelWidth : 0;" + + "" + " Drag.active: dragMouseArea.drag.active; " + - " Drag.hotSpot.x: _halfSideLength; " + - " Drag.hotSpot.y: _halfSideLength; " + "" + " onXChanged: updateCoordinate(); " + " onYChanged: updateCoordinate(); " + "" + " function updateCoordinate() { " + - " vertexDrag.coordinate = _map.toCoordinate(Qt.point(vertexDrag.x + _halfSideLength, vertexDrag.y + _halfSideLength), false); " + + " vertexDrag.coordinate = _map.toCoordinate(Qt.point(vertexDrag.x + _expandMargin + _halfSideLength, vertexDrag.y + _expandMargin + _halfSideLength), false); " + " polygonDrawer._callbackObject.polygonAdjustVertex(vertexDrag.index, vertexDrag.coordinate); " + " } " + "" + " function updatePosition() { " + " var vertexPoint = _map.fromCoordinate(coordinate, false); " + - " vertexDrag.x = vertexPoint.x - _halfSideLength; " + - " vertexDrag.y = vertexPoint.y - _halfSideLength; " + + " vertexDrag.x = vertexPoint.x - _expandMargin - _halfSideLength; " + + " vertexDrag.y = vertexPoint.y - _expandMargin - _halfSideLength; " + " } " + "" + " Connections { " + - " target: _map; " + - " onCenterChanged: updatePosition(); " + + " target: _map; " + + " onCenterChanged: updatePosition(); " + " onZoomLevelChanged: updatePosition(); " + " } " + "" + diff --git a/src/MissionEditor/FWLandingPatternMapVisual.qml b/src/MissionEditor/FWLandingPatternMapVisual.qml index a47056e3b5dc57fe491153fc175e4e8d57dd7b7b..179fba959eec645bf75b81c3b0747edd1521d64b 100644 --- a/src/MissionEditor/FWLandingPatternMapVisual.qml +++ b/src/MissionEditor/FWLandingPatternMapVisual.qml @@ -181,9 +181,7 @@ Item { } } - Drag.active: itemDrag.drag.active - Drag.hotSpot.x: mapQuickItem.anchorPoint.x - Drag.hotSpot.y: mapQuickItem.anchorPoint.y + Drag.active: itemDrag.drag.active MouseArea { id: itemDrag diff --git a/src/MissionEditor/SimpleItemMapVisual.qml b/src/MissionEditor/SimpleItemMapVisual.qml index c81b2563bd99fc37f385f358df35d88d208d7192..a03601b4c11f0334248cb6fac551df16ac0db340 100644 --- a/src/MissionEditor/SimpleItemMapVisual.qml +++ b/src/MissionEditor/SimpleItemMapVisual.qml @@ -82,22 +82,23 @@ Item { Rectangle { id: itemDragger - x: _itemVisual.x - y: _itemVisual.y - width: _itemVisual.width - height: _itemVisual.height + x: _itemVisual.x - _expandMargin + y: _itemVisual.y - _expandMargin + width: _itemVisual.width + (_expandMargin * 2) + height: _itemVisual.height + (_expandMargin * 2) color: "transparent" z: QGroundControl.zOrderMapItems + 1 // Above item icons property bool dragLoiter property bool _preventCoordinateBindingLoop: false + property real _expandMargin: ScreenTools.isMobile ? ScreenTools.defaultFontPixelWidth : 0 onXChanged: liveDrag() onYChanged: liveDrag() function liveDrag() { if (!itemDragger._preventCoordinateBindingLoop && Drag.active) { - var point = Qt.point(itemDragger.x + _itemVisual.anchorPoint.x, itemDragger.y + _itemVisual.anchorPoint.y) + var point = Qt.point(itemDragger.x + _expandMargin + _itemVisual.anchorPoint.x, itemDragger.y + _expandMargin + _itemVisual.anchorPoint.y) var coordinate = map.toCoordinate(point) itemDragger._preventCoordinateBindingLoop = true coordinate.altitude = _missionItem.coordinate.altitude @@ -106,9 +107,7 @@ Item { } } - Drag.active: itemDrag.drag.active - Drag.hotSpot.x: _itemVisual.anchorPoint.x - Drag.hotSpot.y: _itemVisual.anchorPoint.y + Drag.active: itemDrag.drag.active MouseArea { id: itemDrag diff --git a/src/QmlControls/MissionItemIndexLabel.qml b/src/QmlControls/MissionItemIndexLabel.qml index 7e6bb8e74b40a89c090ddbc7ad135384cef977f9..2dbf5bbedf6e9e895d15192e1b083a487b890cc4 100644 --- a/src/QmlControls/MissionItemIndexLabel.qml +++ b/src/QmlControls/MissionItemIndexLabel.qml @@ -23,6 +23,7 @@ Canvas { property real _width: small ? ScreenTools.defaultFontPixelHeight * ScreenTools.smallFontPointRatio * 1.25 : ScreenTools.defaultFontPixelHeight * 1.25 property bool _singleChar: _label.text.length <= 1 + onColorChanged: requestPaint() QGCPalette { id: qgcPal } @@ -73,7 +74,13 @@ Canvas { } MouseArea { - anchors.fill: parent - onClicked: parent.clicked() + anchors.leftMargin: -_expandMargin + anchors.rightMargin: _expandMargin + anchors.topMargin: -_expandMargin + anchors.bottomMargin: _expandMargin + anchors.fill: parent + onClicked: parent.clicked() + + property real _expandMargin: ScreenTools.isMobile ? ScreenTools.defaultFontPixelWidth : 0 } }