7import QGroundControl.Controls
8import QGroundControl.FlightMap
10/// Base component for mission item map visuals providing common drag/indicator infrastructure.
11/// Subclasses must provide an indicatorComponent.
15 property var map ///< Map control to place item in
16 property var vehicle ///< Vehicle associated with this item
17 property bool interactive: true
19 /// Subclasses must set this to their indicator Component
20 property Component indicatorComponent
22 property var _missionItem: object
23 property bool _itemVisualShowing: false
24 property bool _dragAreaShowing: false
26 signal clicked(int sequenceNumber)
28 function hideItemVisuals() {
32 function showItemVisuals() {
36 function hideDragArea() {
37 if (_dragAreaShowing) {
38 dragAreaLoader.active = false
39 _dragAreaShowing = false
43 function showDragArea() {
44 if (!_dragAreaShowing) {
45 dragAreaLoader.active = true
46 _dragAreaShowing = true
50 function updateDragArea() {
51 if (_missionItem.isCurrentItem && map.planView && _missionItem.specifiesCoordinate) {
58 function _hideItemVisuals() {
59 if (_itemVisualShowing) {
60 itemVisualLoader.active = false
61 _itemVisualShowing = false
65 function _showItemVisuals() {
66 if (!_itemVisualShowing) {
67 itemVisualLoader.active = true
68 _itemVisualShowing = true
72 Component.onCompleted: {
80 function onIsCurrentItemChanged() { updateDragArea() }
81 function onSpecifiesCoordinateChanged() { updateDragArea() }
90 sourceComponent: dragAreaComponent
105 sourceComponent: control.indicatorComponent
115 // Control which is used to drag items
117 id: dragAreaComponent
119 MissionItemIndicatorDrag {
120 mapControl: control.map
121 itemIndicator: itemVisualLoader.item
122 itemCoordinate: _missionItem.coordinate
123 visible: control.interactive
124 onItemCoordinateChanged: _missionItem.coordinate = itemCoordinate