Added granularity of some Revive spinner buttons.

This commit is contained in:
2016-12-29 13:35:38 +01:00
parent 342f4795df
commit 950ebf5b08
+65 -65
View File
@@ -259,7 +259,7 @@ MyStackViewPage {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "-" text: "-"
onClicked: { onClicked: {
thumbRangeSlider.decrease() thumbRangeSlider.value -= 0.1
} }
} }
@@ -284,7 +284,7 @@ MyStackViewPage {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "+" text: "+"
onClicked: { onClicked: {
thumbRangeSlider.increase() thumbRangeSlider.value += 0.1
} }
} }
@@ -342,69 +342,10 @@ MyStackViewPage {
GridLayout { GridLayout {
columns: 12 columns: 12
MyText {
text: "Pitch:"
horizontalAlignment: Text.AlignRight
Layout.preferredWidth: 80
Layout.rightMargin: 12
}
MyPushButton2 {
id: touchPitchMinusButton
Layout.preferredWidth: 40
text: "-"
onClicked: {
var val = ReviveTabController.touchPitch - 0.1
if (val < -180.0) {
val = -180.0
}
ReviveTabController.setTouchPitch(val.toFixed(1))
}
}
MyTextField {
id: touchPitchInputField
text: "0.00"
keyBoardUID: 201
Layout.preferredWidth: 140
Layout.leftMargin: 10
Layout.rightMargin: 10
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseFloat(input)
if (!isNaN(val)) {
if (val < -180.0) {
val = -180.0
} else if (val > 180.0) {
val = 180.0
}
var v = val.toFixed(1)
ReviveTabController.setTouchPitch(v, false)
text = v + "°"
} else {
text = ReviveTabController.touchPitch.toFixed(1) + "°"
}
}
}
MyPushButton2 {
id: touchPitchPlusButton
Layout.preferredWidth: 40
text: "+"
onClicked: {
var val = ReviveTabController.touchPitch + 0.1
if (val > 180.0) {
val = 180.0
}
ReviveTabController.setTouchPitch(val.toFixed(1))
}
}
MyText { MyText {
text: "Yaw:" text: "Yaw:"
Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
Layout.leftMargin: 12
Layout.rightMargin: 12 Layout.rightMargin: 12
} }
@@ -413,7 +354,7 @@ MyStackViewPage {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "-" text: "-"
onClicked: { onClicked: {
var val = ReviveTabController.touchYaw - 0.1 var val = ReviveTabController.touchYaw - 1.0
if (val < -180.0) { if (val < -180.0) {
val = -180.0 val = -180.0
} }
@@ -451,7 +392,7 @@ MyStackViewPage {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "+" text: "+"
onClicked: { onClicked: {
var val = ReviveTabController.touchYaw + 0.1 var val = ReviveTabController.touchYaw + 1.0
if (val > 180.0) { if (val > 180.0) {
val = 180.0 val = 180.0
} }
@@ -459,6 +400,65 @@ MyStackViewPage {
} }
} }
MyText {
text: "Pitch:"
horizontalAlignment: Text.AlignRight
Layout.preferredWidth: 80
Layout.leftMargin: 12
Layout.rightMargin: 12
}
MyPushButton2 {
id: touchPitchMinusButton
Layout.preferredWidth: 40
text: "-"
onClicked: {
var val = ReviveTabController.touchPitch - 1.0
if (val < -180.0) {
val = -180.0
}
ReviveTabController.setTouchPitch(val.toFixed(1))
}
}
MyTextField {
id: touchPitchInputField
text: "0.00"
keyBoardUID: 201
Layout.preferredWidth: 140
Layout.leftMargin: 10
Layout.rightMargin: 10
horizontalAlignment: Text.AlignHCenter
function onInputEvent(input) {
var val = parseFloat(input)
if (!isNaN(val)) {
if (val < -180.0) {
val = -180.0
} else if (val > 180.0) {
val = 180.0
}
var v = val.toFixed(1)
ReviveTabController.setTouchPitch(v, false)
text = v + "°"
} else {
text = ReviveTabController.touchPitch.toFixed(1) + "°"
}
}
}
MyPushButton2 {
id: touchPitchPlusButton
Layout.preferredWidth: 40
text: "+"
onClicked: {
var val = ReviveTabController.touchPitch + 1.0
if (val > 180.0) {
val = 180.0
}
ReviveTabController.setTouchPitch(val.toFixed(1))
}
}
MyText { MyText {
text: "Roll:" text: "Roll:"
Layout.fillWidth: true Layout.fillWidth: true
@@ -472,7 +472,7 @@ MyStackViewPage {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "-" text: "-"
onClicked: { onClicked: {
var val = ReviveTabController.touchRoll - 0.1 var val = ReviveTabController.touchRoll - 1.0
if (val < -180.0) { if (val < -180.0) {
val = -180.0 val = -180.0
} }
@@ -510,7 +510,7 @@ MyStackViewPage {
Layout.preferredWidth: 40 Layout.preferredWidth: 40
text: "+" text: "+"
onClicked: { onClicked: {
var val = ReviveTabController.touchRoll + 0.1 var val = ReviveTabController.touchRoll + 1.0
if (val > 180.0) { if (val > 180.0) {
val = 180.0 val = 180.0
} }