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
0d3dd8a1
Commit
0d3dd8a1
authored
Nov 18, 2016
by
Don Gagne
Committed by
GitHub
Nov 18, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4227 from DonLakeFlyer/PolygonDraw
Fix mobile polygon draw
parents
5aeb5bd0
c6091ed4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
FlightMap.qml
src/FlightMap/FlightMap.qml
+16
-2
No files found.
src/FlightMap/FlightMap.qml
View file @
0d3dd8a1
...
@@ -349,8 +349,17 @@ Map {
...
@@ -349,8 +349,17 @@ Map {
// Add first coordinate
// Add first coordinate
polygonPath
.
push
(
clickCoordinate
)
polygonPath
.
push
(
clickCoordinate
)
}
else
{
}
else
{
// Update finalized coordinate
// Add subsequent coordinate
polygonPath
[
polygonDrawerPolygon
.
path
.
length
-
1
]
=
clickCoordinate
if
(
ScreenTools
.
isMobile
)
{
// Since mobile has no mouse, the onPositionChangedHandler will not fire. We have to add the coordinate
// here instead.
polygonDrawer
.
justClicked
=
false
polygonPath
.
push
(
clickCoordinate
)
}
else
{
// The onPositionChanged handler for mouse movement will have already added the coordinate to the array.
// Just update it to the final position
polygonPath
[
polygonDrawerPolygon
.
path
.
length
-
1
]
=
clickCoordinate
}
}
}
polygonDrawerPolygonSet
.
path
=
polygonPath
polygonDrawerPolygonSet
.
path
=
polygonPath
polygonDrawerPolygon
.
path
=
polygonPath
polygonDrawerPolygon
.
path
=
polygonPath
...
@@ -360,10 +369,15 @@ Map {
...
@@ -360,10 +369,15 @@ Map {
}
}
onPositionChanged
:
{
onPositionChanged
:
{
if
(
ScreenTools
.
isMobile
)
{
// We don't track mouse drag on mobile
return
}
if
(
polygonDrawerPolygon
.
path
.
length
)
{
if
(
polygonDrawerPolygon
.
path
.
length
)
{
var
dragCoordinate
=
_map
.
toCoordinate
(
Qt
.
point
(
mouse
.
x
,
mouse
.
y
))
var
dragCoordinate
=
_map
.
toCoordinate
(
Qt
.
point
(
mouse
.
x
,
mouse
.
y
))
var
polygonPath
=
polygonDrawerPolygon
.
path
var
polygonPath
=
polygonDrawerPolygon
.
path
if
(
polygonDrawer
.
justClicked
){
if
(
polygonDrawer
.
justClicked
){
// Add new drag coordinate
polygonPath
.
push
(
dragCoordinate
)
polygonPath
.
push
(
dragCoordinate
)
polygonDrawer
.
justClicked
=
false
polygonDrawer
.
justClicked
=
false
}
}
...
...
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