11 changed files with 228 additions and 42 deletions
@ -0,0 +1,74 @@
@@ -0,0 +1,74 @@
|
||||
import QtQuick 2.5 |
||||
import QtQuick.Controls 1.2 |
||||
|
||||
import QGroundControl.Palette 1.0 |
||||
import QGroundControl.ScreenTools 1.0 |
||||
|
||||
Rectangle { |
||||
radius: width / 2 |
||||
border.color: mapPal.thumbJoystick |
||||
border.width: 2 |
||||
color: "transparent" |
||||
|
||||
property alias lightColors: mapPal.lightColors /// true: use light colors from QGCMapPalette for drawing |
||||
property var stickPosition: Qt.point(0, 0) |
||||
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 _stickCenteredOnce: false |
||||
|
||||
QGCMapPalette { id: mapPal } |
||||
|
||||
onWidthChanged: { |
||||
if (!_stickCenteredOnce && width != 0) { |
||||
reCenter() |
||||
} |
||||
} |
||||
|
||||
onStickPositionChanged: { |
||||
var xAxisTemp = stickPosition.x / width |
||||
xAxisTemp *= 2.0 |
||||
xAxisTemp -= 1.0 |
||||
xAxis = xAxisTemp |
||||
|
||||
var yAxisTemp = stickPosition.y / width |
||||
yAxisTemp *= 2.0 |
||||
yAxisTemp -= 1.0 |
||||
if (yAxisThrottle) { |
||||
yAxisTemp = ((yAxisTemp * -1.0) / 2.0) + 0.5 |
||||
} |
||||
yAxis = yAxisTemp |
||||
} |
||||
|
||||
function reCenter() |
||||
{ |
||||
stickPosition = Qt.point(width / 2, width / 2) |
||||
} |
||||
|
||||
Column { |
||||
QGCLabel { text: xAxis } |
||||
QGCLabel { text: yAxis } |
||||
} |
||||
|
||||
Rectangle { |
||||
anchors.margins: parent.width / 4 |
||||
anchors.fill: parent |
||||
radius: width / 2 |
||||
border.color: mapPal.thumbJoystick |
||||
border.width: 2 |
||||
color: "transparent" |
||||
} |
||||
|
||||
Rectangle { |
||||
width: hatWidth |
||||
height: hatWidth |
||||
radius: hatWidthHalf |
||||
color: mapPal.thumbJoystick |
||||
x: stickPosition.x - hatWidthHalf |
||||
y: stickPosition.y - hatWidthHalf |
||||
|
||||
readonly property real hatWidth: ScreenTools.defaultFontPixelHeight |
||||
readonly property real hatWidthHalf: ScreenTools.defaultFontPixelHeight / 2 |
||||
} |
||||
} |
@ -1,38 +1,32 @@
@@ -1,38 +1,32 @@
|
||||
Module QGroundControl.Controls |
||||
|
||||
QGCLabel 1.0 QGCLabel.qml |
||||
QGCButton 1.0 QGCButton.qml |
||||
QGCRadioButton 1.0 QGCRadioButton.qml |
||||
QGCCheckBox 1.0 QGCCheckBox.qml |
||||
QGCTextField 1.0 QGCTextField.qml |
||||
QGCComboBox 1.0 QGCComboBox.qml |
||||
QGCColoredImage 1.0 QGCColoredImage.qml |
||||
QGCToolBarButton 1.0 QGCToolBarButton.qml |
||||
QGCMovableItem 1.0 QGCMovableItem.qml |
||||
|
||||
SubMenuButton 1.0 SubMenuButton.qml |
||||
IndicatorButton 1.0 IndicatorButton.qml |
||||
DropButton 1.0 DropButton.qml |
||||
RoundButton 1.0 RoundButton.qml |
||||
VehicleRotationCal 1.0 VehicleRotationCal.qml |
||||
VehicleSummaryRow 1.0 VehicleSummaryRow.qml |
||||
ViewWidget 1.0 ViewWidget.qml |
||||
ExclusiveGroupItem 1.0 ExclusiveGroupItem.qml |
||||
|
||||
ClickableColor 1.0 ClickableColor.qml |
||||
DropButton 1.0 DropButton.qml |
||||
ExclusiveGroupItem 1.0 ExclusiveGroupItem.qml |
||||
IndicatorButton 1.0 IndicatorButton.qml |
||||
JoystickThumbPad 1.0 JoystickThumbPad.qml |
||||
MainToolBar 1.0 MainToolBar.qml |
||||
MissionItemEditor 1.0 MissionItemEditor.qml |
||||
MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml |
||||
ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml |
||||
ParameterEditor 1.0 ParameterEditor.qml |
||||
ParameterEditorDialog 1.0 ParameterEditorDialog.qml |
||||
|
||||
ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml |
||||
|
||||
QGCView 1.0 QGCView.qml |
||||
QGCViewPanel 1.0 QGCViewPanel.qml |
||||
QGCViewDialog 1.0 QGCViewDialog.qml |
||||
QGCViewMessage 1.0 QGCViewMessage.qml |
||||
|
||||
MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml |
||||
MissionItemEditor 1.0 MissionItemEditor.qml |
||||
|
||||
MainToolBar 1.0 MainToolBar.qml |
||||
SignalStrength 1.0 SignalStrength.qml |
||||
|
||||
ClickableColor 1.0 ClickableColor.qml |
||||
QGCButton 1.0 QGCButton.qml |
||||
QGCCheckBox 1.0 QGCCheckBox.qml |
||||
QGCColoredImage 1.0 QGCColoredImage.qml |
||||
QGCComboBox 1.0 QGCComboBox.qml |
||||
QGCLabel 1.0 QGCLabel.qml |
||||
QGCMovableItem 1.0 QGCMovableItem.qml |
||||
QGCRadioButton 1.0 QGCRadioButton.qml |
||||
QGCTextField 1.0 QGCTextField.qml |
||||
QGCToolBarButton 1.0 QGCToolBarButton.qml |
||||
QGCView 1.0 QGCView.qml |
||||
QGCViewDialog 1.0 QGCViewDialog.qml |
||||
QGCViewMessage 1.0 QGCViewMessage.qml |
||||
QGCViewPanel 1.0 QGCViewPanel.qml |
||||
RoundButton 1.0 RoundButton.qml |
||||
SignalStrength 1.0 SignalStrength.qml |
||||
SubMenuButton 1.0 SubMenuButton.qml |
||||
VehicleRotationCal 1.0 VehicleRotationCal.qml |
||||
VehicleSummaryRow 1.0 VehicleSummaryRow.qml |
||||
ViewWidget 1.0 ViewWidget.qml |
||||
|
Loading…
Reference in new issue