Browse Source

JoystickThumbPad: Add center variable to control Y throttle behaviour

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
QGC4.4
Patrick José Pereira 6 years ago
parent
commit
c3fba6e8a5
  1. 15
      src/QmlControls/JoystickThumbPad.qml

15
src/QmlControls/JoystickThumbPad.qml

@ -11,15 +11,14 @@ Item { @@ -11,15 +11,14 @@ Item {
property real xAxis: 0 ///< Value range [-1,1], negative values left stick, positive values right stick
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 bool yAxisThrottleCentered: false ///< false: center yAxis in throttle for reverser and forward
property real xPositionDelta: 0 ///< Amount to move the control on x axis
property real yPositionDelta: 0 ///< Amount to move the control on y axis
property bool throttle: false
property real _centerXY: width / 2
property bool _processTouchPoints: false
property bool _stickCenteredOnce: false
property real stickPositionX: _centerXY
property real stickPositionY: yAxisThrottle ? height : _centerXY
property real stickPositionY: yAxisThrottleCentered ? _centerXY : height
QGCMapPalette { id: mapPal }
@ -50,7 +49,7 @@ Item { @@ -50,7 +49,7 @@ Item {
// Center sticks
stickPositionX = _centerXY
if (!yAxisThrottle) {
if (yAxisThrottleCentered) {
stickPositionY = _centerXY
}
}
@ -86,7 +85,7 @@ Item { @@ -86,7 +85,7 @@ Item {
QGCColoredImage {
color: lightColors ? "white" : "black"
visible: throttle
visible: yAxisThrottle
height: ScreenTools.defaultFontPixelHeight
width: height
sourceSize.height: height
@ -100,7 +99,7 @@ Item { @@ -100,7 +99,7 @@ Item {
QGCColoredImage {
color: lightColors ? "white" : "black"
visible: throttle
visible: yAxisThrottle
height: ScreenTools.defaultFontPixelHeight
width: height
sourceSize.height: height
@ -114,7 +113,7 @@ Item { @@ -114,7 +113,7 @@ Item {
QGCColoredImage {
color: lightColors ? "white" : "black"
visible: throttle
visible: yAxisThrottle
height: ScreenTools.defaultFontPixelHeight
width: height
sourceSize.height: height
@ -128,7 +127,7 @@ Item { @@ -128,7 +127,7 @@ Item {
QGCColoredImage {
color: lightColors ? "white" : "black"
visible: throttle
visible: yAxisThrottle
height: ScreenTools.defaultFontPixelHeight
width: height
sourceSize.height: height

Loading…
Cancel
Save