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
59df13a2
Commit
59df13a2
authored
Nov 29, 2015
by
Gus Grubba
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2306 from DonLakeFlyer/MultiTouch
Fix virtual joystick MultiTouch
parents
6c714562
c4bfa9ce
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+21
-10
JoystickThumbPad.qml
src/QmlControls/JoystickThumbPad.qml
+3
-0
No files found.
src/FlightDisplay/FlightDisplayView.qml
View file @
59df13a2
...
...
@@ -232,7 +232,10 @@ Item {
MultiPointTouchArea
{
anchors.fill
:
parent
maximumTouchPoints
:
2
touchPoints
:
[
TouchPoint
{
id
:
point1
},
TouchPoint
{
id
:
point2
}
]
property
var
leftRect
:
Qt
.
rect
(
0
,
0
,
parent
.
thumbAreaHeight
,
parent
.
thumbAreaHeight
)
property
var
rightRect
:
Qt
.
rect
(
parent
.
width
-
parent
.
thumbAreaHeight
,
0
,
parent
.
thumbAreaHeight
,
parent
.
thumbAreaHeight
)
...
...
@@ -251,6 +254,7 @@ Item {
var
point1
if
(
touchPoints
.
length
>
0
)
{
//console.log("Point1", touchPoints[0].x, touchPoints[0].y)
point1
=
touchPoints
[
0
]
if
(
pointInRect
(
leftRect
,
point1
))
{
point1Location
=
-
1
...
...
@@ -261,6 +265,7 @@ Item {
var
point2
if
(
touchPoints
.
length
==
2
)
{
//console.log("Point2", touchPoints[1].x, touchPoints[1].y)
point2
=
touchPoints
[
1
]
if
(
pointInRect
(
leftRect
,
point2
))
{
point2Location
=
-
1
...
...
@@ -269,33 +274,39 @@ Item {
}
}
var
leftStickSet
=
false
var
rightStickSet
=
false
// Make sure points are not both in the same rect
if
(
point1Location
!=
point2Location
)
{
if
(
point1Location
!=
0
)
{
if
(
point1Location
==
-
1
)
{
leftStick
.
stickPosition
=
point1
leftStickSet
=
true
}
else
{
rightStick
.
stickPosition
=
Qt
.
point
(
point1
.
x
-
(
multiTouchItem
.
width
-
multiTouchItem
.
thumbAreaHeight
),
point1
.
y
)
rightStickSet
=
true
}
}
if
(
point2Location
!=
0
)
{
if
(
point2Location
==
-
1
)
{
rightStick
.
stickPosition
=
Qt
.
point
(
point2
.
x
-
(
multiTouchItem
.
width
-
multiTouchItem
.
thumbAreaHeight
),
point2
.
y
)
}
else
{
leftStick
.
stickPosition
=
point2
leftStickSet
=
true
}
else
{
rightStick
.
stickPosition
=
Qt
.
point
(
point2
.
x
-
(
multiTouchItem
.
width
-
multiTouchItem
.
thumbAreaHeight
),
point2
.
y
)
rightStickSet
=
true
}
}
}
}
onPressed
:
newTouchPoints
(
touchPoints
)
onTouchUpdated
:
newTouchPoints
(
touchPoints
)
onReleased
:
{
if
(
!
leftStickSet
)
{
leftStick
.
reCenter
()
}
if
(
!
rightStickSet
)
{
rightStick
.
reCenter
()
}
}
onTouchUpdated
:
newTouchPoints
(
touchPoints
)
}
Timer
{
...
...
src/QmlControls/JoystickThumbPad.qml
View file @
59df13a2
...
...
@@ -46,10 +46,13 @@ Rectangle {
stickPosition
=
Qt
.
point
(
width
/
2
,
width
/
2
)
}
/*
Keep in for debugging
Column {
QGCLabel { text: xAxis }
QGCLabel { text: yAxis }
}
*/
Rectangle
{
anchors.margins
:
parent
.
width
/
4
...
...
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