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
1991d269
Commit
1991d269
authored
Mar 02, 2017
by
Don Gagne
Committed by
GitHub
Mar 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4684 from DonLakeFlyer/ItemTouch
Improve touch support for map item dragging
parents
b3dac085
c16149c0
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 @
1991d269
...
@@ -244,10 +244,11 @@ Map {
...
@@ -244,10 +244,11 @@ Map {
"
import QtQuick 2.5;
"
+
"
import QtQuick 2.5;
"
+
"
import QtLocation 5.3;
"
+
"
import QtLocation 5.3;
"
+
"
import QGroundControl.ScreenTools 1.0;
"
+
"
import QGroundControl.ScreenTools 1.0;
"
+
""
+
"
Rectangle {
"
+
"
Rectangle {
"
+
"
id: vertexDrag;
"
+
"
id: vertexDrag;
"
+
"
width: _sideLength;
"
+
"
width: _sideLength
+ _expandMargin
;
"
+
"
height: _sideLength;
"
+
"
height: _sideLength
+ _expandMargin
;
"
+
"
color: 'red';
"
+
"
color: 'red';
"
+
""
+
""
+
"
property var coordinate;
"
+
"
property var coordinate;
"
+
...
@@ -256,27 +257,27 @@ Map {
...
@@ -256,27 +257,27 @@ Map {
"
readonly property real _sideLength: ScreenTools.defaultFontPixelWidth * 2;
"
+
"
readonly property real _sideLength: ScreenTools.defaultFontPixelWidth * 2;
"
+
"
readonly property real _halfSideLength: _sideLength / 2;
"
+
"
readonly property real _halfSideLength: _sideLength / 2;
"
+
""
+
""
+
"
property real _expandMargin: ScreenTools.isMobile ? ScreenTools.defaultFontPixelWidth : 0;
"
+
""
+
"
Drag.active: dragMouseArea.drag.active;
"
+
"
Drag.active: dragMouseArea.drag.active;
"
+
"
Drag.hotSpot.x: _halfSideLength;
"
+
"
Drag.hotSpot.y: _halfSideLength;
"
+
""
+
""
+
"
onXChanged: updateCoordinate();
"
+
"
onXChanged: updateCoordinate();
"
+
"
onYChanged: updateCoordinate();
"
+
"
onYChanged: updateCoordinate();
"
+
""
+
""
+
"
function 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);
"
+
"
polygonDrawer._callbackObject.polygonAdjustVertex(vertexDrag.index, vertexDrag.coordinate);
"
+
"
}
"
+
"
}
"
+
""
+
""
+
"
function updatePosition() {
"
+
"
function updatePosition() {
"
+
"
var vertexPoint = _map.fromCoordinate(coordinate, false);
"
+
"
var vertexPoint = _map.fromCoordinate(coordinate, false);
"
+
"
vertexDrag.x = vertexPoint.x - _halfSideLength;
"
+
"
vertexDrag.x = vertexPoint.x - _
expandMargin - _
halfSideLength;
"
+
"
vertexDrag.y = vertexPoint.y - _halfSideLength;
"
+
"
vertexDrag.y = vertexPoint.y - _
expandMargin - _
halfSideLength;
"
+
"
}
"
+
"
}
"
+
""
+
""
+
"
Connections {
"
+
"
Connections {
"
+
"
target: _map;
"
+
"
target:
_map;
"
+
"
onCenterChanged: updatePosition();
"
+
"
onCenterChanged:
updatePosition();
"
+
"
onZoomLevelChanged: updatePosition();
"
+
"
onZoomLevelChanged: updatePosition();
"
+
"
}
"
+
"
}
"
+
""
+
""
+
...
...
src/MissionEditor/FWLandingPatternMapVisual.qml
View file @
1991d269
...
@@ -181,9 +181,7 @@ Item {
...
@@ -181,9 +181,7 @@ Item {
}
}
}
}
Drag.active
:
itemDrag
.
drag
.
active
Drag.active
:
itemDrag
.
drag
.
active
Drag.hotSpot.x
:
mapQuickItem
.
anchorPoint
.
x
Drag.hotSpot.y
:
mapQuickItem
.
anchorPoint
.
y
MouseArea
{
MouseArea
{
id
:
itemDrag
id
:
itemDrag
...
...
src/MissionEditor/SimpleItemMapVisual.qml
View file @
1991d269
...
@@ -82,22 +82,23 @@ Item {
...
@@ -82,22 +82,23 @@ Item {
Rectangle
{
Rectangle
{
id
:
itemDragger
id
:
itemDragger
x
:
_itemVisual
.
x
x
:
_itemVisual
.
x
-
_expandMargin
y
:
_itemVisual
.
y
y
:
_itemVisual
.
y
-
_expandMargin
width
:
_itemVisual
.
width
width
:
_itemVisual
.
width
+
(
_expandMargin
*
2
)
height
:
_itemVisual
.
height
height
:
_itemVisual
.
height
+
(
_expandMargin
*
2
)
color
:
"
transparent
"
color
:
"
transparent
"
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
property
bool
dragLoiter
property
bool
dragLoiter
property
bool
_preventCoordinateBindingLoop
:
false
property
bool
_preventCoordinateBindingLoop
:
false
property
real
_expandMargin
:
ScreenTools
.
isMobile
?
ScreenTools
.
defaultFontPixelWidth
:
0
onXChanged
:
liveDrag
()
onXChanged
:
liveDrag
()
onYChanged
:
liveDrag
()
onYChanged
:
liveDrag
()
function
liveDrag
()
{
function
liveDrag
()
{
if
(
!
itemDragger
.
_preventCoordinateBindingLoop
&&
Drag
.
active
)
{
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
)
var
coordinate
=
map
.
toCoordinate
(
point
)
itemDragger
.
_preventCoordinateBindingLoop
=
true
itemDragger
.
_preventCoordinateBindingLoop
=
true
coordinate
.
altitude
=
_missionItem
.
coordinate
.
altitude
coordinate
.
altitude
=
_missionItem
.
coordinate
.
altitude
...
@@ -106,9 +107,7 @@ Item {
...
@@ -106,9 +107,7 @@ Item {
}
}
}
}
Drag.active
:
itemDrag
.
drag
.
active
Drag.active
:
itemDrag
.
drag
.
active
Drag.hotSpot.x
:
_itemVisual
.
anchorPoint
.
x
Drag.hotSpot.y
:
_itemVisual
.
anchorPoint
.
y
MouseArea
{
MouseArea
{
id
:
itemDrag
id
:
itemDrag
...
...
src/QmlControls/MissionItemIndexLabel.qml
View file @
1991d269
...
@@ -23,6 +23,7 @@ Canvas {
...
@@ -23,6 +23,7 @@ Canvas {
property
real
_width
:
small
?
ScreenTools
.
defaultFontPixelHeight
*
ScreenTools
.
smallFontPointRatio
*
1.25
:
ScreenTools
.
defaultFontPixelHeight
*
1.25
property
real
_width
:
small
?
ScreenTools
.
defaultFontPixelHeight
*
ScreenTools
.
smallFontPointRatio
*
1.25
:
ScreenTools
.
defaultFontPixelHeight
*
1.25
property
bool
_singleChar
:
_label
.
text
.
length
<=
1
property
bool
_singleChar
:
_label
.
text
.
length
<=
1
onColorChanged
:
requestPaint
()
onColorChanged
:
requestPaint
()
QGCPalette
{
id
:
qgcPal
}
QGCPalette
{
id
:
qgcPal
}
...
@@ -73,7 +74,13 @@ Canvas {
...
@@ -73,7 +74,13 @@ Canvas {
}
}
MouseArea
{
MouseArea
{
anchors.fill
:
parent
anchors.leftMargin
:
-
_expandMargin
onClicked
:
parent
.
clicked
()
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