Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
c16149c0
Commit
c16149c0
authored
Mar 02, 2017
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve touch support for map item dragging
parent
b3dac085
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
22 deletions
+27
-22
FlightMap.qml
src/FlightMap/FlightMap.qml
+10
-9
FWLandingPatternMapVisual.qml
src/MissionEditor/FWLandingPatternMapVisual.qml
+1
-3
SimpleItemMapVisual.qml
src/MissionEditor/SimpleItemMapVisual.qml
+7
-8
MissionItemIndexLabel.qml
src/QmlControls/MissionItemIndexLabel.qml
+9
-2
No files found.
src/FlightMap/FlightMap.qml
View file @
c16149c0
...
...
@@ -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();
"
+
"
}
"
+
""
+
...
...
src/MissionEditor/FWLandingPatternMapVisual.qml
View file @
c16149c0
...
...
@@ -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
...
...
src/MissionEditor/SimpleItemMapVisual.qml
View file @
c16149c0
...
...
@@ -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
...
...
src/QmlControls/MissionItemIndexLabel.qml
View file @
c16149c0
...
...
@@ -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
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment