Show/hide jumping & flying checkbox depending on movement mode

This commit is contained in:
David Rowe 2018-09-28 13:02:27 +12:00
parent 5ab22a1f40
commit 4813f4d042
2 changed files with 25 additions and 5 deletions

View file

@ -18,8 +18,20 @@ Preference {
height: control.height + hifi.dimensions.controlInterlineHeight height: control.height + hifi.dimensions.controlInterlineHeight
property int value: 0
Component.onCompleted: { Component.onCompleted: {
repeater.itemAt(preference.value).checked = true value = preference.value;
repeater.itemAt(preference.value).checked = true;
}
function updateValue() {
for (var i = 0; i < repeater.count; i++) {
if (repeater.itemAt(i).checked) {
value = i;
break;
}
}
} }
function save() { function save() {
@ -61,9 +73,9 @@ Preference {
anchors { anchors {
left: parent.left left: parent.left
} }
leftPadding: 0 leftPadding: 0
colorScheme: hifi.colorSchemes.dark colorScheme: hifi.colorSchemes.dark
onClicked: updateValue();
} }
} }
} }

View file

@ -123,10 +123,18 @@ Item {
} }
// Runtime customization of preferences. // Runtime customization of preferences.
var locomotionPreference = findPreference("VR Movement", "Teleporting only / Walking and teleporting");
var flyingPreference = findPreference("VR Movement", "Jumping and flying");
if (locomotionPreference && flyingPreference) {
flyingPreference.visible = (locomotionPreference.value === 1);
locomotionPreference.valueChanged.connect(function () {
flyingPreference.visible = (locomotionPreference.value === 1);
});
}
if (HMD.isHeadControllerAvailable("Oculus")) { if (HMD.isHeadControllerAvailable("Oculus")) {
var preference = findPreference("VR Movement", "Show room boundaries while teleporting"); var boundariesPreference = findPreference("VR Movement", "Show room boundaries while teleporting");
if (preference) { if (boundariesPreference) {
preference.label = "Show room boundaries and sensors while teleporting"; boundariesPreference.label = "Show room boundaries and sensors while teleporting";
} }
} }