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
34204c2e
Commit
34204c2e
authored
Jun 15, 2016
by
Don Gagne
Committed by
GitHub
Jun 15, 2016
Browse files
Options
Browse Files
Download
Plain Diff
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
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
JoystickThumbPad.qml
src/QmlControls/JoystickThumbPad.qml
+15
-6
No files found.
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
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