mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 10:19:06 +02:00
Fix various issues with SpinBox-es and Sliders
This commit is contained in:
parent
b8577bd791
commit
0e28e41107
7 changed files with 53 additions and 52 deletions
|
@ -24,6 +24,7 @@ Slider {
|
||||||
|
|
||||||
property alias minimumValue: slider.from
|
property alias minimumValue: slider.from
|
||||||
property alias maximumValue: slider.to
|
property alias maximumValue: slider.to
|
||||||
|
property bool tickmarksEnabled: false
|
||||||
|
|
||||||
height: hifi.fontSizes.textFieldInput + 14 // Match height of TextField control.
|
height: hifi.fontSizes.textFieldInput + 14 // Match height of TextField control.
|
||||||
y: sliderLabel.visible ? sliderLabel.height + sliderLabel.anchors.bottomMargin : 0
|
y: sliderLabel.visible ? sliderLabel.height + sliderLabel.anchors.bottomMargin : 0
|
||||||
|
|
|
@ -71,16 +71,16 @@ SpinBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
validator: DoubleValidator {
|
validator: DoubleValidator {
|
||||||
bottom: Math.min(spinBox.from, spinBox.to)*spinBox.factor
|
bottom: Math.min(spinBox.from, spinBox.to)
|
||||||
top: Math.max(spinBox.from, spinBox.to)*spinBox.factor
|
top: Math.max(spinBox.from, spinBox.to)
|
||||||
}
|
}
|
||||||
|
|
||||||
textFromValue: function(value, locale) {
|
textFromValue: function(value, locale) {
|
||||||
return parseFloat(value*1.0/factor).toFixed(decimals);
|
return parseFloat(value/factor).toFixed(decimals);
|
||||||
}
|
}
|
||||||
|
|
||||||
valueFromText: function(text, locale) {
|
valueFromText: function(text, locale) {
|
||||||
return Number.fromLocaleString(locale, text);
|
return Number.fromLocaleString(locale, text)*factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@ Preference {
|
||||||
height: control.height + hifi.dimensions.controlInterlineHeight
|
height: control.height + hifi.dimensions.controlInterlineHeight
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
spinner.value = preference.value;
|
spinner.realValue = preference.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
preference.value = spinner.value;
|
preference.value = spinner.realValue;
|
||||||
preference.save();
|
preference.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ Preference {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
slider.value = preference.value;
|
slider.value = preference.value;
|
||||||
spinner.value = preference.value;
|
spinner.realValue = preference.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
@ -60,7 +60,7 @@ Preference {
|
||||||
maximumValue: MyAvatar.getDomainMaxScale()
|
maximumValue: MyAvatar.getDomainMaxScale()
|
||||||
stepSize: preference.step
|
stepSize: preference.step
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
spinner.value = value
|
spinner.realValue = value
|
||||||
}
|
}
|
||||||
anchors {
|
anchors {
|
||||||
right: spinner.left
|
right: spinner.left
|
||||||
|
@ -73,12 +73,12 @@ Preference {
|
||||||
SpinBox {
|
SpinBox {
|
||||||
id: spinner
|
id: spinner
|
||||||
decimals: preference.decimals
|
decimals: preference.decimals
|
||||||
value: preference.value
|
realValue: preference.value
|
||||||
minimumValue: MyAvatar.getDomainMinScale()
|
minimumValue: MyAvatar.getDomainMinScale()
|
||||||
maximumValue: MyAvatar.getDomainMaxScale()
|
maximumValue: MyAvatar.getDomainMaxScale()
|
||||||
width: 100
|
width: 100
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
slider.value = value;
|
slider.value = realValue;
|
||||||
}
|
}
|
||||||
anchors {
|
anchors {
|
||||||
right: button.left
|
right: button.left
|
||||||
|
@ -92,10 +92,10 @@ Preference {
|
||||||
id: button
|
id: button
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (spinner.maximumValue >= 1) {
|
if (spinner.maximumValue >= 1) {
|
||||||
spinner.value = 1
|
spinner.realValue = 1
|
||||||
slider.value = 1
|
slider.value = 1
|
||||||
} else {
|
} else {
|
||||||
spinner.value = spinner.maximumValue
|
spinner.realValue = spinner.maximumValue
|
||||||
slider.value = spinner.maximumValue
|
slider.value = spinner.maximumValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,4 +108,4 @@ Preference {
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,11 +181,11 @@ Item {
|
||||||
minimumValue: 0.01
|
minimumValue: 0.01
|
||||||
maximumValue: 10
|
maximumValue: 10
|
||||||
realStepSize: 0.05;
|
realStepSize: 0.05;
|
||||||
value: attachment ? attachment.scale : 1.0
|
realValue: attachment ? attachment.scale : 1.0
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
onValueChanged: {
|
onRealValueChanged: {
|
||||||
if (completed && attachment && attachment.scale !== value) {
|
if (completed && attachment && attachment.scale !== realValue) {
|
||||||
attachment.scale = value;
|
attachment.scale = realValue;
|
||||||
updateAttachment();
|
updateAttachment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ Item {
|
||||||
id: xspinner
|
id: xspinner
|
||||||
width: root.spinboxWidth
|
width: root.spinboxWidth
|
||||||
anchors { left: parent.left }
|
anchors { left: parent.left }
|
||||||
value: root.vector.x
|
realValue: root.vector.x
|
||||||
labelInside: "X:"
|
labelInside: "X:"
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
colorLabelInside: hifi.colors.redHighlight
|
colorLabelInside: hifi.colors.redHighlight
|
||||||
|
@ -72,17 +72,17 @@ Item {
|
||||||
id: yspinner
|
id: yspinner
|
||||||
width: root.spinboxWidth
|
width: root.spinboxWidth
|
||||||
anchors { horizontalCenter: parent.horizontalCenter }
|
anchors { horizontalCenter: parent.horizontalCenter }
|
||||||
value: root.vector.y
|
realValue: root.vector.y
|
||||||
labelInside: "Y:"
|
labelInside: "Y:"
|
||||||
colorLabelInside: hifi.colors.greenHighlight
|
colorLabelInside: hifi.colors.greenHighlight
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
decimals: root.decimals
|
decimals: root.decimals
|
||||||
stepSize: root.stepSize
|
realStepSize: root.stepSize
|
||||||
maximumValue: root.maximumValue
|
maximumValue: root.maximumValue
|
||||||
minimumValue: root.minimumValue
|
minimumValue: root.minimumValue
|
||||||
onValueChanged: {
|
onRealValueChanged: {
|
||||||
if (value !== vector.y) {
|
if (realValue !== vector.y) {
|
||||||
vector.y = value
|
vector.y = realValue
|
||||||
root.valueChanged();
|
root.valueChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,17 +93,17 @@ Item {
|
||||||
id: zspinner
|
id: zspinner
|
||||||
width: root.spinboxWidth
|
width: root.spinboxWidth
|
||||||
anchors { right: parent.right; }
|
anchors { right: parent.right; }
|
||||||
value: root.vector.z
|
realValue: root.vector.z
|
||||||
labelInside: "Z:"
|
labelInside: "Z:"
|
||||||
colorLabelInside: hifi.colors.primaryHighlight
|
colorLabelInside: hifi.colors.primaryHighlight
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
decimals: root.decimals
|
decimals: root.decimals
|
||||||
stepSize: root.stepSize
|
realStepSize: root.stepSize
|
||||||
maximumValue: root.maximumValue
|
maximumValue: root.maximumValue
|
||||||
minimumValue: root.minimumValue
|
minimumValue: root.minimumValue
|
||||||
onValueChanged: {
|
onRealValueChanged: {
|
||||||
if (value !== vector.z) {
|
if (realValue !== vector.z) {
|
||||||
vector.z = value
|
vector.z = realValue
|
||||||
root.valueChanged();
|
root.valueChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,8 +178,8 @@ Rectangle {
|
||||||
label: "Y Offset"
|
label: "Y Offset"
|
||||||
suffix: " cm"
|
suffix: " cm"
|
||||||
minimumValue: -10
|
minimumValue: -10
|
||||||
stepSize: 1
|
realStepSize: 1
|
||||||
value: -5
|
realValue: -5
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
|
@ -193,10 +193,10 @@ Rectangle {
|
||||||
width: 112
|
width: 112
|
||||||
label: "Z Offset"
|
label: "Z Offset"
|
||||||
minimumValue: -10
|
minimumValue: -10
|
||||||
stepSize: 1
|
realStepSize: 1
|
||||||
decimals: 1
|
decimals: 1
|
||||||
suffix: " cm"
|
suffix: " cm"
|
||||||
value: -5
|
realValue: -5
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
|
@ -288,7 +288,7 @@ Rectangle {
|
||||||
suffix: " cm"
|
suffix: " cm"
|
||||||
label: "Y Offset"
|
label: "Y Offset"
|
||||||
minimumValue: -10
|
minimumValue: -10
|
||||||
stepSize: 1
|
realStepSize: 1
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
|
@ -303,7 +303,7 @@ Rectangle {
|
||||||
label: "Z Offset"
|
label: "Z Offset"
|
||||||
suffix: " cm"
|
suffix: " cm"
|
||||||
minimumValue: -10
|
minimumValue: -10
|
||||||
stepSize: 1
|
realStepSize: 1
|
||||||
decimals: 1
|
decimals: 1
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
||||||
|
@ -535,9 +535,9 @@ Rectangle {
|
||||||
suffix: " cm"
|
suffix: " cm"
|
||||||
label: "Arm Circumference"
|
label: "Arm Circumference"
|
||||||
minimumValue: 0
|
minimumValue: 0
|
||||||
stepSize: 1.0
|
realStepSize: 1.0
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
value: 33.0
|
realValue: 33.0
|
||||||
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
sendConfigurationSettings();
|
sendConfigurationSettings();
|
||||||
|
@ -550,10 +550,10 @@ Rectangle {
|
||||||
label: "Shoulder Width"
|
label: "Shoulder Width"
|
||||||
suffix: " cm"
|
suffix: " cm"
|
||||||
minimumValue: 0
|
minimumValue: 0
|
||||||
stepSize: 1.0
|
realStepSize: 1.0
|
||||||
decimals: 1
|
decimals: 1
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
value: 48
|
realValue: 48
|
||||||
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
sendConfigurationSettings();
|
sendConfigurationSettings();
|
||||||
|
@ -659,13 +659,13 @@ Rectangle {
|
||||||
InputConfiguration.uncalibratePlugin(pluginName);
|
InputConfiguration.uncalibratePlugin(pluginName);
|
||||||
updateCalibrationButton();
|
updateCalibrationButton();
|
||||||
} else {
|
} else {
|
||||||
calibrationTimer.interval = timeToCalibrate.value * 1000
|
calibrationTimer.interval = timeToCalibrate.realValue * 1000
|
||||||
openVrConfiguration.countDown = timeToCalibrate.value;
|
openVrConfiguration.countDown = timeToCalibrate.realValue;
|
||||||
var calibratingScreen = screen.createObject();
|
var calibratingScreen = screen.createObject();
|
||||||
stack.push(calibratingScreen);
|
stack.push(calibratingScreen);
|
||||||
calibratingScreen.canceled.connect(cancelCalibration);
|
calibratingScreen.canceled.connect(cancelCalibration);
|
||||||
calibratingScreen.restart.connect(restartCalibration);
|
calibratingScreen.restart.connect(restartCalibration);
|
||||||
calibratingScreen.start(calibrationTimer.interval, timeToCalibrate.value);
|
calibratingScreen.start(calibrationTimer.interval, timeToCalibrate.realValue);
|
||||||
calibrationTimer.start();
|
calibrationTimer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -728,12 +728,12 @@ Rectangle {
|
||||||
anchors.leftMargin: leftMargin
|
anchors.leftMargin: leftMargin
|
||||||
|
|
||||||
minimumValue: 5
|
minimumValue: 5
|
||||||
value: 5
|
realValue: 5
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
calibrationTimer.interval = value * 1000;
|
calibrationTimer.interval = realValue * 1000;
|
||||||
openVrConfiguration.countDown = value;
|
openVrConfiguration.countDown = realValue;
|
||||||
numberAnimation.duration = calibrationTimer.interval;
|
numberAnimation.duration = calibrationTimer.interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -910,8 +910,8 @@ Rectangle {
|
||||||
var desktopMode = settings["desktopMode"];
|
var desktopMode = settings["desktopMode"];
|
||||||
var hmdDesktopPosition = settings["hmdDesktopTracking"];
|
var hmdDesktopPosition = settings["hmdDesktopTracking"];
|
||||||
|
|
||||||
armCircumference.value = settings.armCircumference;
|
armCircumference.realValue = settings.armCircumference;
|
||||||
shoulderWidth.value = settings.shoulderWidth;
|
shoulderWidth.realValue = settings.shoulderWidth;
|
||||||
|
|
||||||
if (HmdHead) {
|
if (HmdHead) {
|
||||||
headBox.checked = true;
|
headBox.checked = true;
|
||||||
|
@ -1075,22 +1075,22 @@ Rectangle {
|
||||||
|
|
||||||
var headObject = {
|
var headObject = {
|
||||||
"override": overrideHead,
|
"override": overrideHead,
|
||||||
"Y": headYOffset.value,
|
"Y": headYOffset.realValue,
|
||||||
"Z": headZOffset.value
|
"Z": headZOffset.realValue
|
||||||
}
|
}
|
||||||
|
|
||||||
var handObject = {
|
var handObject = {
|
||||||
"override": overrideHandController,
|
"override": overrideHandController,
|
||||||
"Y": handYOffset.value,
|
"Y": handYOffset.realValue,
|
||||||
"Z": handZOffset.value
|
"Z": handZOffset.realValue
|
||||||
}
|
}
|
||||||
|
|
||||||
var settingsObject = {
|
var settingsObject = {
|
||||||
"bodyConfiguration": trackerConfiguration,
|
"bodyConfiguration": trackerConfiguration,
|
||||||
"headConfiguration": headObject,
|
"headConfiguration": headObject,
|
||||||
"handConfiguration": handObject,
|
"handConfiguration": handObject,
|
||||||
"armCircumference": armCircumference.value,
|
"armCircumference": armCircumference.realValue,
|
||||||
"shoulderWidth": shoulderWidth.value,
|
"shoulderWidth": shoulderWidth.realValue,
|
||||||
"desktopMode": viveInDesktop.checked,
|
"desktopMode": viveInDesktop.checked,
|
||||||
"hmdDesktopTracking": hmdInDesktop.checked
|
"hmdDesktopTracking": hmdInDesktop.checked
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue