This commit is contained in:
Wayne Chen 2019-03-20 18:07:50 -07:00
parent 6cf8b06c6d
commit 584fa1f17b
2 changed files with 95 additions and 5 deletions

View file

@ -28,10 +28,93 @@ Rectangle {
signal sendToScript(var message);
function emitSendToScript(message) {
console.log("sending to script");
console.log(JSON.stringify(message));
sendToScript(message);
}
function fromScript(message) {
}
RalewayRegular {
id: title;
color: hifi.colors.white;
text: qsTr("Avatar Inputs Persistent UI Settings")
size: 20
font.bold: true
anchors {
top: parent.top
left: parent.left
leftMargin: (parent.width - width) / 2
}
}
HifiControlsUit.Slider {
id: xSlider
anchors {
top: title.bottom
topMargin: 50
left: parent.left
}
label: "X OFFSET"
maximumValue: 1.0
minimumValue: -1.0
stepSize: 0.05
value: -0.2
width: 300
onValueChanged: {
emitSendToScript({
"method": "reposition",
"x": value
});
}
}
HifiControlsUit.Slider {
id: ySlider
anchors {
top: xSlider.bottom
topMargin: 50
left: parent.left
}
label: "Y OFFSET"
maximumValue: 1.0
minimumValue: -1.0
stepSize: 0.05
value: -0.125
width: 300
onValueChanged: {
emitSendToScript({
"method": "reposition",
"y": value
});
}
}
HifiControlsUit.Slider {
anchors {
top: ySlider.bottom
topMargin: 50
left: parent.left
}
label: "Y OFFSET"
maximumValue: 0.0
minimumValue: -1.0
stepSize: 0.05
value: -0.5
width: 300
onValueChanged: {
emitSendToScript({
"method": "reposition",
"z": value
});
}
}
HifiControlsUit.Button {
id: setVisibleButton
}
HifiControlsUit.Button {
}
}

View file

@ -13,7 +13,7 @@
var AVATAR_INPUTS_EDIT_QML_SOURCE = "hifi/EditAvatarInputsBar.qml";
function fromQml(message) {
console.log("message from QML: " + JSON.stringify(message));
print("message from QML: " + JSON.stringify(message));
};
function onClicked(){
@ -72,10 +72,17 @@
};
function setup() {
button = tablet.addButton({
icon: "icons/tablet-icons/edit-i.svg",
activeIcon: "icons/tablet-icons/edit-a.svg",
text: buttonName
// button = tablet.addButton({
// icon: "icons/tablet-icons/edit-i.svg",
// activeIcon: "icons/tablet-icons/edit-a.svg",
// text: buttonName
// });
ui = new AppUi({
buttonName: "AVBAR",
home: Script.resourcesPath() + "qml/hifi/EditAvatarInputsBar.qml",
onMessage: fromQml,
// normalButton: "icons/tablet-icons/avatar-i.svg",
// activeButton: "icons/tablet-icons/avatar-a.svg",
});
button.clicked.connect(onClicked);
};