Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
34204c2e
Commit
34204c2e
authored
Jun 15, 2016
by
Don Gagne
Committed by
GitHub
Jun 15, 2016
Browse files
Merge pull request #3570 from DonLakeFlyer/VirtualJoyThrottle
Virtual joystick: Throttle no longer spring loaded to center
parents
a86eecaf
50804a77
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/QmlControls/JoystickThumbPad.qml
View file @
34204c2e
...
...
@@ -12,13 +12,13 @@ Item {
property
real
yAxis
:
0
///< Value range [-1,1], negative values up stick, positive values down stick
property
bool
yAxisThrottle
:
false
///< true: yAxis used for throttle, range [1,0], positive value are stick up
property
real
xPositionDelta
:
0
///< Amount to move the control on x axis
property
real
yPositionDelta
:
0
///< A
n
ount to move the control on y axis
property
real
yPositionDelta
:
0
///< A
m
ount to move the control on y axis
property
real
_centerXY
:
width
/
2
property
bool
_processTouchPoints
:
false
property
bool
_stickCenteredOnce
:
false
property
real
stickPositionX
:
_centerXY
property
real
stickPositionY
:
_centerXY
property
real
stickPositionY
:
yAxisThrottle
?
height
:
_centerXY
QGCMapPalette
{
id
:
mapPal
}
...
...
@@ -30,7 +30,7 @@ Item {
}
onStickPositionYChanged
:
{
var
yAxisTemp
=
stickPositionY
/
width
var
yAxisTemp
=
stickPositionY
/
height
yAxisTemp
*=
2.0
yAxisTemp
-=
1.0
if
(
yAxisThrottle
)
{
...
...
@@ -42,19 +42,28 @@ Item {
function
reCenter
()
{
_processTouchPoints
=
false
// Move control back to original position
xPositionDelta
=
0
yPositionDelta
=
0
// Center sticks
stickPositionX
=
_centerXY
stickPositionY
=
_centerXY
if
(
!
yAxisThrottle
)
{
stickPositionY
=
_centerXY
}
}
function
thumbDown
(
touchPoints
)
{
//
Center
the control around the initial thumb position
//
Position
the control around the initial thumb position
xPositionDelta
=
touchPoints
[
0
].
x
-
_centerXY
yPositionDelta
=
touchPoints
[
0
].
y
-
_centerXY
if
(
yAxisThrottle
)
{
yPositionDelta
=
touchPoints
[
0
].
y
-
stickPositionY
}
else
{
yPositionDelta
=
touchPoints
[
0
].
y
-
_centerXY
}
// We need to wait until we move the control to the right position before we process touch points
_processTouchPoints
=
true
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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