mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 13:49:46 +02:00
Fix toolbar button activation states
This commit is contained in:
parent
2260c0965c
commit
827fa98baa
6 changed files with 19 additions and 43 deletions
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
var TABLET_BUTTON_NAME = "AUDIO";
|
var TABLET_BUTTON_NAME = "AUDIO";
|
||||||
var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png";
|
var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png";
|
||||||
|
var AUDIO_QML_SOURCE = "../audio/Audio.qml";
|
||||||
|
|
||||||
var MUTE_ICONS = {
|
var MUTE_ICONS = {
|
||||||
icon: "icons/tablet-icons/mic-mute-i.svg",
|
icon: "icons/tablet-icons/mic-mute-i.svg",
|
||||||
|
@ -34,7 +35,6 @@ function onMuteToggled() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var shouldActivateButton = false;
|
|
||||||
var onAudioScreen = false;
|
var onAudioScreen = false;
|
||||||
|
|
||||||
function onClicked() {
|
function onClicked() {
|
||||||
|
@ -44,18 +44,14 @@ function onClicked() {
|
||||||
} else {
|
} else {
|
||||||
var entity = HMD.tabletID;
|
var entity = HMD.tabletID;
|
||||||
Entities.editEntity(entity, { textures: JSON.stringify({ "tex.close": HOME_BUTTON_TEXTURE }) });
|
Entities.editEntity(entity, { textures: JSON.stringify({ "tex.close": HOME_BUTTON_TEXTURE }) });
|
||||||
shouldActivateButton = true;
|
tablet.loadQMLSource(AUDIO_QML_SOURCE);
|
||||||
shouldActivateButton = true;
|
|
||||||
tablet.loadQMLSource("../audio/Audio.qml");
|
|
||||||
onAudioScreen = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScreenChanged(type, url) {
|
function onScreenChanged(type, url) {
|
||||||
|
onAudioScreen = (type === "QML" && url === AUDIO_QML_SOURCE);
|
||||||
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
||||||
button.editProperties({isActive: shouldActivateButton});
|
button.editProperties({isActive: onAudioScreen});
|
||||||
shouldActivateButton = false;
|
|
||||||
onAudioScreen = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
|
|
@ -40,7 +40,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScreenChanged(type, url) {
|
function onScreenChanged(type, url) {
|
||||||
onHelpScreen = false;
|
onHelpScreen = type === "Web" && url.startsWith("../../../html/tabletHelp.html");
|
||||||
|
button.editProperties({ isActive: onHelpScreen });
|
||||||
}
|
}
|
||||||
|
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
|
|
|
@ -52,17 +52,11 @@ function onMessageBoxClosed(id, button) {
|
||||||
|
|
||||||
Window.messageBoxClosed.connect(onMessageBoxClosed);
|
Window.messageBoxClosed.connect(onMessageBoxClosed);
|
||||||
|
|
||||||
var shouldActivateButton = false;
|
|
||||||
var onMarketplaceScreen = false;
|
var onMarketplaceScreen = false;
|
||||||
|
|
||||||
function showMarketplace() {
|
function showMarketplace() {
|
||||||
UserActivityLogger.openedMarketplace();
|
UserActivityLogger.openedMarketplace();
|
||||||
|
|
||||||
shouldActivateButton = true;
|
|
||||||
|
|
||||||
tablet.gotoWebScreen(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
|
tablet.gotoWebScreen(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
|
||||||
onMarketplaceScreen = true;
|
|
||||||
|
|
||||||
tablet.webEventReceived.connect(function (message) {
|
tablet.webEventReceived.connect(function (message) {
|
||||||
|
|
||||||
if (message === GOTO_DIRECTORY) {
|
if (message === GOTO_DIRECTORY) {
|
||||||
|
@ -122,7 +116,6 @@ function onClick() {
|
||||||
if (onMarketplaceScreen) {
|
if (onMarketplaceScreen) {
|
||||||
// for toolbar-mode: go back to home screen, this will close the window.
|
// for toolbar-mode: go back to home screen, this will close the window.
|
||||||
tablet.gotoHomeScreen();
|
tablet.gotoHomeScreen();
|
||||||
onMarketplaceScreen = false;
|
|
||||||
} else {
|
} else {
|
||||||
var entity = HMD.tabletID;
|
var entity = HMD.tabletID;
|
||||||
Entities.editEntity(entity, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})});
|
Entities.editEntity(entity, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})});
|
||||||
|
@ -131,10 +124,9 @@ function onClick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScreenChanged(type, url) {
|
function onScreenChanged(type, url) {
|
||||||
|
onMarketplaceScreen = type === "Web" && url === MARKETPLACE_URL_INITIAL
|
||||||
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
||||||
marketplaceButton.editProperties({isActive: shouldActivateButton});
|
marketplaceButton.editProperties({isActive: onMarketplaceScreen});
|
||||||
shouldActivateButton = false;
|
|
||||||
onMarketplaceScreen = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
marketplaceButton.clicked.connect(onClick);
|
marketplaceButton.clicked.connect(onClick);
|
||||||
|
|
|
@ -21,7 +21,6 @@ var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-
|
||||||
sortOrder: 3
|
sortOrder: 3
|
||||||
});
|
});
|
||||||
|
|
||||||
var shouldActivateButton = false;
|
|
||||||
var onMenuScreen = false;
|
var onMenuScreen = false;
|
||||||
|
|
||||||
function onClicked() {
|
function onClicked() {
|
||||||
|
@ -31,17 +30,13 @@ var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-
|
||||||
} else {
|
} else {
|
||||||
var entity = HMD.tabletID;
|
var entity = HMD.tabletID;
|
||||||
Entities.editEntity(entity, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})});
|
Entities.editEntity(entity, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})});
|
||||||
shouldActivateButton = true;
|
|
||||||
tablet.gotoMenuScreen();
|
tablet.gotoMenuScreen();
|
||||||
onMenuScreen = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScreenChanged(type, url) {
|
function onScreenChanged(type, url) {
|
||||||
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
onMenuScreen = type === "Menu";
|
||||||
button.editProperties({isActive: shouldActivateButton});
|
button.editProperties({isActive: onMenuScreen});
|
||||||
shouldActivateButton = false;
|
|
||||||
onMenuScreen = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
|
|
|
@ -40,7 +40,7 @@ var HOVER_TEXTURES = {
|
||||||
var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6};
|
var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6};
|
||||||
var SELECTED_COLOR = {red: 0xF3, green: 0x91, blue: 0x29};
|
var SELECTED_COLOR = {red: 0xF3, green: 0x91, blue: 0x29};
|
||||||
var HOVER_COLOR = {red: 0xD0, green: 0xD0, blue: 0xD0}; // almost white for now
|
var HOVER_COLOR = {red: 0xD0, green: 0xD0, blue: 0xD0}; // almost white for now
|
||||||
|
var PAL_QML_SOURCE = "../Pal.qml";
|
||||||
var conserveResources = true;
|
var conserveResources = true;
|
||||||
|
|
||||||
Script.include("/~/system/libraries/controllers.js");
|
Script.include("/~/system/libraries/controllers.js");
|
||||||
|
@ -726,17 +726,14 @@ function tabletVisibilityChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var onPalScreen = false;
|
var onPalScreen = false;
|
||||||
var shouldActivateButton = false;
|
|
||||||
|
|
||||||
function onTabletButtonClicked() {
|
function onTabletButtonClicked() {
|
||||||
if (onPalScreen) {
|
if (onPalScreen) {
|
||||||
// for toolbar-mode: go back to home screen, this will close the window.
|
// for toolbar-mode: go back to home screen, this will close the window.
|
||||||
tablet.gotoHomeScreen();
|
tablet.gotoHomeScreen();
|
||||||
} else {
|
} else {
|
||||||
shouldActivateButton = true;
|
tablet.loadQMLSource(PAL_QML_SOURCE);
|
||||||
tablet.loadQMLSource("../Pal.qml");
|
|
||||||
tablet.tabletShownChanged.connect(tabletVisibilityChanged);
|
tablet.tabletShownChanged.connect(tabletVisibilityChanged);
|
||||||
onPalScreen = true;
|
|
||||||
Users.requestsDomainListData = true;
|
Users.requestsDomainListData = true;
|
||||||
populateNearbyUserList();
|
populateNearbyUserList();
|
||||||
isWired = true;
|
isWired = true;
|
||||||
|
@ -764,14 +761,13 @@ function wireEventBridge(on) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTabletScreenChanged(type, url) {
|
function onTabletScreenChanged(type, url) {
|
||||||
wireEventBridge(shouldActivateButton);
|
onPalScreen = (type === "QML" && url === PAL_QML_SOURCE);
|
||||||
|
wireEventBridge(onPalScreen);
|
||||||
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
||||||
button.editProperties({isActive: shouldActivateButton});
|
button.editProperties({isActive: onPalScreen});
|
||||||
shouldActivateButton = false;
|
|
||||||
onPalScreen = false;
|
|
||||||
|
|
||||||
// disable sphere overlays when not on pal screen.
|
// disable sphere overlays when not on pal screen.
|
||||||
if (type !== "QML" || url !== "../Pal.qml") {
|
if (!onPalScreen) {
|
||||||
off();
|
off();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,18 +377,15 @@ function fillImageDataFromPrevious() {
|
||||||
|
|
||||||
var SNAPSHOT_REVIEW_URL = Script.resolvePath("html/SnapshotReview.html");
|
var SNAPSHOT_REVIEW_URL = Script.resolvePath("html/SnapshotReview.html");
|
||||||
var isInSnapshotReview = false;
|
var isInSnapshotReview = false;
|
||||||
var shouldActivateButton = false;
|
|
||||||
function onButtonClicked() {
|
function onButtonClicked() {
|
||||||
if (isInSnapshotReview){
|
if (isInSnapshotReview){
|
||||||
// for toolbar-mode: go back to home screen, this will close the window.
|
// for toolbar-mode: go back to home screen, this will close the window.
|
||||||
tablet.gotoHomeScreen();
|
tablet.gotoHomeScreen();
|
||||||
} else {
|
} else {
|
||||||
shouldActivateButton = true;
|
|
||||||
fillImageDataFromPrevious();
|
fillImageDataFromPrevious();
|
||||||
tablet.gotoWebScreen(SNAPSHOT_REVIEW_URL);
|
tablet.gotoWebScreen(SNAPSHOT_REVIEW_URL);
|
||||||
tablet.webEventReceived.connect(onMessage);
|
tablet.webEventReceived.connect(onMessage);
|
||||||
HMD.openTablet();
|
HMD.openTablet();
|
||||||
isInSnapshotReview = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,11 +659,10 @@ function maybeDeleteSnapshotStories() {
|
||||||
storyIDsToMaybeDelete = [];
|
storyIDsToMaybeDelete = [];
|
||||||
}
|
}
|
||||||
function onTabletScreenChanged(type, url) {
|
function onTabletScreenChanged(type, url) {
|
||||||
button.editProperties({ isActive: shouldActivateButton });
|
isInSnapshotReview = (type === "Web" && url === SNAPSHOT_REVIEW_URL);
|
||||||
shouldActivateButton = false;
|
button.editProperties({ isActive: isInSnapshotReview });
|
||||||
if (isInSnapshotReview) {
|
if (!isInSnapshotReview) {
|
||||||
tablet.webEventReceived.disconnect(onMessage);
|
tablet.webEventReceived.disconnect(onMessage);
|
||||||
isInSnapshotReview = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onUsernameChanged() {
|
function onUsernameChanged() {
|
||||||
|
|
Loading…
Reference in a new issue