|
|
@ -11,26 +11,38 @@ Item { |
|
|
|
property real xAxis: 0 ///< Value range [-1,1], negative values left stick, positive values right stick |
|
|
|
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 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 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 xPositionDelta: 0 ///< Amount to move the control on x axis |
|
|
|
property real yPositionDelta: 0 ///< Amount to move the control on y axis |
|
|
|
property real yPositionDelta: 0 ///< Amount to move the control on y axis |
|
|
|
property bool throttle: false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property real _centerXY: width / 2 |
|
|
|
property real _centerXY: width / 2 |
|
|
|
property bool _processTouchPoints: false |
|
|
|
property bool _processTouchPoints: false |
|
|
|
property bool _stickCenteredOnce: false |
|
|
|
|
|
|
|
property real stickPositionX: _centerXY |
|
|
|
property real stickPositionX: _centerXY |
|
|
|
property real stickPositionY: yAxisThrottle ? height : _centerXY |
|
|
|
property real stickPositionY: yAxisThrottleCentered ? _centerXY : height |
|
|
|
|
|
|
|
|
|
|
|
QGCMapPalette { id: mapPal } |
|
|
|
QGCMapPalette { id: mapPal } |
|
|
|
|
|
|
|
|
|
|
|
onStickPositionXChanged: { |
|
|
|
onWidthChanged: calculateXAxis() |
|
|
|
|
|
|
|
onStickPositionXChanged: calculateXAxis() |
|
|
|
|
|
|
|
onHeightChanged: calculateYAxis() |
|
|
|
|
|
|
|
onStickPositionYChanged: calculateYAxis() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function calculateXAxis() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(!visible()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
var xAxisTemp = stickPositionX / width |
|
|
|
var xAxisTemp = stickPositionX / width |
|
|
|
xAxisTemp *= 2.0 |
|
|
|
xAxisTemp *= 2.0 |
|
|
|
xAxisTemp -= 1.0 |
|
|
|
xAxisTemp -= 1.0 |
|
|
|
xAxis = xAxisTemp |
|
|
|
xAxis = xAxisTemp |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onStickPositionYChanged: { |
|
|
|
function calculateYAxis() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if(!visible()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
var yAxisTemp = stickPositionY / height |
|
|
|
var yAxisTemp = stickPositionY / height |
|
|
|
yAxisTemp *= 2.0 |
|
|
|
yAxisTemp *= 2.0 |
|
|
|
yAxisTemp -= 1.0 |
|
|
|
yAxisTemp -= 1.0 |
|
|
@ -50,7 +62,7 @@ Item { |
|
|
|
|
|
|
|
|
|
|
|
// Center sticks |
|
|
|
// Center sticks |
|
|
|
stickPositionX = _centerXY |
|
|
|
stickPositionX = _centerXY |
|
|
|
if (!yAxisThrottle) { |
|
|
|
if (yAxisThrottleCentered) { |
|
|
|
stickPositionY = _centerXY |
|
|
|
stickPositionY = _centerXY |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -86,7 +98,7 @@ Item { |
|
|
|
|
|
|
|
|
|
|
|
QGCColoredImage { |
|
|
|
QGCColoredImage { |
|
|
|
color: lightColors ? "white" : "black" |
|
|
|
color: lightColors ? "white" : "black" |
|
|
|
visible: throttle |
|
|
|
visible: yAxisThrottle |
|
|
|
height: ScreenTools.defaultFontPixelHeight |
|
|
|
height: ScreenTools.defaultFontPixelHeight |
|
|
|
width: height |
|
|
|
width: height |
|
|
|
sourceSize.height: height |
|
|
|
sourceSize.height: height |
|
|
@ -100,7 +112,7 @@ Item { |
|
|
|
|
|
|
|
|
|
|
|
QGCColoredImage { |
|
|
|
QGCColoredImage { |
|
|
|
color: lightColors ? "white" : "black" |
|
|
|
color: lightColors ? "white" : "black" |
|
|
|
visible: throttle |
|
|
|
visible: yAxisThrottle |
|
|
|
height: ScreenTools.defaultFontPixelHeight |
|
|
|
height: ScreenTools.defaultFontPixelHeight |
|
|
|
width: height |
|
|
|
width: height |
|
|
|
sourceSize.height: height |
|
|
|
sourceSize.height: height |
|
|
@ -114,7 +126,7 @@ Item { |
|
|
|
|
|
|
|
|
|
|
|
QGCColoredImage { |
|
|
|
QGCColoredImage { |
|
|
|
color: lightColors ? "white" : "black" |
|
|
|
color: lightColors ? "white" : "black" |
|
|
|
visible: throttle |
|
|
|
visible: yAxisThrottle |
|
|
|
height: ScreenTools.defaultFontPixelHeight |
|
|
|
height: ScreenTools.defaultFontPixelHeight |
|
|
|
width: height |
|
|
|
width: height |
|
|
|
sourceSize.height: height |
|
|
|
sourceSize.height: height |
|
|
@ -128,7 +140,7 @@ Item { |
|
|
|
|
|
|
|
|
|
|
|
QGCColoredImage { |
|
|
|
QGCColoredImage { |
|
|
|
color: lightColors ? "white" : "black" |
|
|
|
color: lightColors ? "white" : "black" |
|
|
|
visible: throttle |
|
|
|
visible: yAxisThrottle |
|
|
|
height: ScreenTools.defaultFontPixelHeight |
|
|
|
height: ScreenTools.defaultFontPixelHeight |
|
|
|
width: height |
|
|
|
width: height |
|
|
|
sourceSize.height: height |
|
|
|
sourceSize.height: height |
|
|
|