mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 15:23:05 +02:00
attempt to add active tablet button
This commit is contained in:
parent
80eac56c4d
commit
20b6cddc56
1 changed files with 23 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
||||||
var APP_NAME = "BLOCKS";
|
var APP_NAME = "BLOCKS";
|
||||||
var APP_URL = "https://vr.google.com/objects/";
|
var APP_URL = "https://vr.google.com/objects/";
|
||||||
var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-i.svg";
|
var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-i.svg";
|
||||||
|
var APP_ICON_ACTIVE = "https://hifi-content.s3.amazonaws.com/elisalj/blocks/blocks-a.svg";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
print("Current Interface version: " + Window.checkVersion());
|
print("Current Interface version: " + Window.checkVersion());
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var button = tablet.addButton({
|
var button = tablet.addButton({
|
||||||
icon: APP_ICON,
|
icon: APP_ICON,
|
||||||
|
activeIcon: APP_ICON_ACTIVE,
|
||||||
text: APP_NAME
|
text: APP_NAME
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,6 +37,26 @@
|
||||||
}
|
}
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
|
|
||||||
|
function onScreenChanged(type, url) {
|
||||||
|
if (url !== null) {
|
||||||
|
tabletButton.editProperties({ isActive: true });
|
||||||
|
|
||||||
|
if (!shown) {
|
||||||
|
// hook up to the event bridge
|
||||||
|
tablet.webEventReceived.connect(onWebEventReceived);
|
||||||
|
}
|
||||||
|
shown = true;
|
||||||
|
} else {
|
||||||
|
tabletButton.editProperties({ isActive: false });
|
||||||
|
|
||||||
|
if (shown) {
|
||||||
|
// disconnect from the event bridge
|
||||||
|
tablet.webEventReceived.disconnect(onWebEventReceived);
|
||||||
|
}
|
||||||
|
shown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
tablet.removeButton(button);
|
tablet.removeButton(button);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue