mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-09 20:32:48 +02:00
all hud buttons on tablet
This commit is contained in:
parent
fa761af1a6
commit
5ed8831bee
11 changed files with 65 additions and 78 deletions
28
interface/resources/icons/tablet-icons/ignore-i.svg
Normal file
28
interface/resources/icons/tablet-icons/ignore-i.svg
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#FFFFFF;}
|
||||
</style>
|
||||
<g id="Layer_2">
|
||||
</g>
|
||||
<g id="Layer_1">
|
||||
<path class="st0" d="M27.1,42.3c-1.4,0.3-2.7,0.5-4.1,0.5c-9.3,0-16.8-7.5-16.8-16.8S13.8,9.2,23,9.2S39.8,16.7,39.8,26
|
||||
c0,0.2,0,0.3,0,0.5c0.7-0.7,1.4-1,2.4-1.5C41.7,14.9,33.3,6.8,23,6.8C12.4,6.8,3.8,15.4,3.8,26S12.4,45.2,23,45.2
|
||||
c1.7,0,3.4-0.3,5.1-0.7C27.8,43.6,27.5,43,27.1,42.3z"/>
|
||||
<path class="st0" d="M32.6,20.7L32.6,20.7c-0.4-0.4-0.7-0.4-1.2-0.3c0,0-5.9,0.7-8.4,0.7h-0.1c-2.5,0-8.6-0.9-8.6-0.9
|
||||
c-0.4-0.1-0.9,0-1.2,0.4L13,21c-0.1,0.3-0.1,0.6-0.1,1c0.1,0.3,0.3,0.6,0.6,0.7c1,0.4,4.9,1.8,5.9,2.1c0.1,0,0.6,0.1,0.6,0.9
|
||||
c0,0.9-0.3,4.6-0.7,6.4c-0.4,1.8-1.2,4-1.2,4c-0.1,0.6,0.1,1.3,0.7,1.5l0.7,0.3c0.3,0.1,0.6,0.1,0.9,0c0.3-0.1,0.4-0.4,0.6-0.7
|
||||
l2.1-6.4l1.9,6.5c0.1,0.3,0.3,0.6,0.6,0.7c0.1,0.1,0.3,0.1,0.4,0.1c0.1,0,0.3,0,0.4-0.1l0.7-0.3c0.6-0.1,0.9-0.7,0.7-1.3
|
||||
c0,0-0.6-2.4-1-4.3c-0.3-1.2-0.4-3-0.4-4.3c0-0.9-0.1-1.6-0.1-2.2c0-0.3,0.1-0.6,0.6-0.7c0.1,0,5.5-1.9,5.5-1.9
|
||||
c0.4-0.1,0.6-0.4,0.7-0.9C32.9,21.5,32.9,21,32.6,20.7z"/>
|
||||
<circle class="st0" cx="23" cy="17" r="2.5"/>
|
||||
<g>
|
||||
<path class="st0" d="M43.1,43L43.1,43L43.1,43z"/>
|
||||
<path class="st0" d="M41,35.6l4.6-4.6c0.7-0.7,0.7-1.9,0-2.6c-0.7-0.7-1.9-0.7-2.6,0L38.5,33l-4.6-4.6c-0.7-0.7-1.9-0.7-2.6,0
|
||||
s-0.7,1.9,0,2.6l4.6,4.6l-4.6,4.6c-0.7,0.7-0.7,1.9,0,2.6s1.9,0.7,2.6,0l4.6-4.6l4.6,4.6c0.7,0.7,1.9,0.7,2.6,0
|
||||
c0.7-0.7,0.7-1.9,0-2.6L41,35.6z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
|
@ -177,8 +177,8 @@
|
|||
|
||||
// Cleanup the toolbar button and overlays when script is stopped
|
||||
Script.scriptEnding.connect(function () {
|
||||
tablet.removeButton(button);
|
||||
button.clicked.disconnect(Users.toggleIgnoreRadius);
|
||||
tablet.removeButton(button);
|
||||
Users.ignoreRadiusEnabledChanged.disconnect(onBubbleToggled);
|
||||
Users.enteredIgnoreRadius.disconnect(enteredIgnoreRadius);
|
||||
Overlays.deleteOverlay(bubbleOverlay);
|
||||
|
|
|
@ -478,7 +478,6 @@ var toolBar = (function () {
|
|||
toolBar.writeProperty("shown", false);
|
||||
toolBar.writeProperty("shown", true);
|
||||
}
|
||||
// toolBar.selectTool(activeButton, isActive);
|
||||
lightOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_IN_EDIT_MODE));
|
||||
Entities.setDrawZoneBoundaries(isActive && Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE));
|
||||
};
|
||||
|
|
|
@ -36,8 +36,8 @@ button.clicked.connect(onClicked);
|
|||
DialogsManager.addressBarShown.connect(onAddressBarShown);
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
tablet.removeButton(button);
|
||||
button.clicked.disconnect(onClicked);
|
||||
tablet.removeButton(button);
|
||||
DialogsManager.addressBarShown.disconnect(onAddressBarShown);
|
||||
});
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var button = tablet.addButton({
|
||||
icon: "icons/tablet-icons/help-i.svg",
|
||||
text: "HELP"
|
||||
});
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ function calcSpawnInfo() {
|
|||
|
||||
// ctor
|
||||
WebTablet = function (url, width, dpi, location, clientOnly) {
|
||||
|
||||
print(url);
|
||||
var _this = this;
|
||||
var ASPECT = 4.0 / 3.0;
|
||||
var WIDTH = width || DEFAULT_WIDTH;
|
||||
|
@ -54,7 +54,7 @@ WebTablet = function (url, width, dpi, location, clientOnly) {
|
|||
var spawnInfo = calcSpawnInfo();
|
||||
var tabletEntityPosition = spawnInfo.position;
|
||||
var tabletEntityRotation = spawnInfo.rotation;
|
||||
|
||||
|
||||
var tabletProperties = {
|
||||
name: "WebTablet Tablet",
|
||||
type: "Model",
|
||||
|
@ -75,7 +75,7 @@ WebTablet = function (url, width, dpi, location, clientOnly) {
|
|||
tabletProperties.position = spawnInfo.position;
|
||||
tabletProperties.rotation = spawnInfo.rotation;
|
||||
}
|
||||
|
||||
this.tabletURL = url;
|
||||
this.tabletEntityID = Entities.addEntity(tabletProperties, clientOnly);
|
||||
|
||||
var WEB_ENTITY_Z_OFFSET = -0.01;
|
||||
|
@ -117,6 +117,8 @@ WebTablet = function (url, width, dpi, location, clientOnly) {
|
|||
Entities.editEntity(_this.homeButtonEntity, {color: {red: 255, green: 255, blue: 0}});
|
||||
_this.clicked = true;
|
||||
}
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
tablet.gotoHomeScreen();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,30 +42,11 @@ function shouldShowWebTablet() {
|
|||
}
|
||||
|
||||
function showMarketplace(marketplaceID) {
|
||||
if (shouldShowWebTablet()) {
|
||||
updateButtonState(true);
|
||||
|
||||
if (HMD.tabletID) {
|
||||
UIWebTablet.createWebEntity("https://metaverse.highfidelity.com/marketplace");
|
||||
HMD.tabletID = UIWebTablet.webEntityID;
|
||||
} else {
|
||||
marketplaceWebTablet = new WebTablet("https://metaverse.highfidelity.com/marketplace",
|
||||
null, // width
|
||||
null, // dpi
|
||||
null, // location
|
||||
true); // client-only
|
||||
marketplaceWebTablet.register();
|
||||
}
|
||||
Settings.setValue(persistenceKey, marketplaceWebTablet.pickle());
|
||||
} else {
|
||||
var url = MARKETPLACE_URL;
|
||||
if (marketplaceID) {
|
||||
url = url + "/items/" + marketplaceID;
|
||||
}
|
||||
marketplaceWindow.setURL(url);
|
||||
marketplaceWindow.setVisible(true);
|
||||
var url = MARKETPLACE_URL;
|
||||
if (marketplaceID) {
|
||||
url = url + "/items/" + marketplaceID;
|
||||
}
|
||||
|
||||
tablet.gotoWebScreen(url);
|
||||
marketplaceVisible = true;
|
||||
UserActivityLogger.openedMarketplace();
|
||||
}
|
||||
|
@ -81,15 +62,15 @@ function hideTablet(tablet) {
|
|||
Settings.setValue(persistenceKey, "");
|
||||
}
|
||||
function clearOldTablet() { // If there was a tablet from previous domain or session, kill it and let it be recreated
|
||||
var tablet = WebTablet.unpickle(Settings.getValue(persistenceKey, ""));
|
||||
hideTablet(tablet);
|
||||
//var tablet = WebTablet.unpickle(Settings.getValue(persistenceKey, ""));
|
||||
//hideTablet(tablet);
|
||||
}
|
||||
function hideMarketplace() {
|
||||
if (marketplaceWindow.visible) {
|
||||
marketplaceWindow.setVisible(false);
|
||||
marketplaceWindow.setURL("about:blank");
|
||||
} else if (marketplaceWebTablet) {
|
||||
hideTablet(marketplaceWebTablet);
|
||||
//hideTablet(marketplaceWebTablet);
|
||||
}
|
||||
marketplaceVisible = false;
|
||||
}
|
||||
|
@ -102,21 +83,17 @@ function toggleMarketplace() {
|
|||
}
|
||||
}
|
||||
|
||||
var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
||||
var browseExamplesButton = toolBar.addButton({
|
||||
imageURL: toolIconUrl + "market.svg",
|
||||
objectName: "marketplace",
|
||||
buttonState: 1,
|
||||
defaultState: 1,
|
||||
hoverState: 3,
|
||||
alpha: 0.9
|
||||
var browseExamplesButton = tablet.addButton({
|
||||
icon: "icons/tablet-icons/market-i.svg",
|
||||
text: "MARKET"
|
||||
});
|
||||
|
||||
function updateButtonState(visible) {
|
||||
browseExamplesButton.writeProperty('buttonState', visible ? 0 : 1);
|
||||
browseExamplesButton.writeProperty('defaultState', visible ? 0 : 1);
|
||||
browseExamplesButton.writeProperty('hoverState', visible ? 2 : 3);
|
||||
//browseExamplesButton.writeProperty('buttonState', visible ? 0 : 1);
|
||||
//browseExamplesButton.writeProperty('defaultState', visible ? 0 : 1);
|
||||
//browseExamplesButton.writeProperty('hoverState', visible ? 2 : 3);
|
||||
}
|
||||
function onMarketplaceWindowVisibilityChanged() {
|
||||
updateButtonState(marketplaceWindow.visible);
|
||||
|
@ -135,8 +112,8 @@ clearOldTablet(); // Run once at startup, in case there's anything laying around
|
|||
// but the HUD version stays around, so lets do the same.
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
toolBar.removeButton("marketplace");
|
||||
browseExamplesButton.clicked.disconnect(onClick);
|
||||
tablet.removeButton(browseExamplesButton);
|
||||
marketplaceWindow.visibleChanged.disconnect(onMarketplaceWindowVisibilityChanged);
|
||||
});
|
||||
|
||||
|
|
|
@ -24,18 +24,18 @@ var ASSETS_PATH = Script.resolvePath("assets");
|
|||
var TOOLS_PATH = Script.resolvePath("assets/images/tools/");
|
||||
|
||||
function buttonImageURL() {
|
||||
return "icons/tablet-icons/" + (Users.canKick ? 'kick.svg' : 'ignore.svg');
|
||||
return (Users.canKick ? "kick.svg" : "ignore.svg");
|
||||
}
|
||||
|
||||
// setup the mod button and add it to the toolbar
|
||||
var button = toolbar.addButton({
|
||||
icon: buttonImageURL(),
|
||||
var button = tablet.addButton({
|
||||
icon: "icons/tablet-icons/ignore-i.svg",
|
||||
text: "KICK"
|
||||
});
|
||||
|
||||
// if this user's kick permissions change, change the state of the button in the HUD
|
||||
Users.canKickChanged.connect(function(canKick){
|
||||
button.editProperties({icon: buttonImageURL()});
|
||||
button.editProperties({text: buttonImageURL()});
|
||||
});
|
||||
|
||||
var isShowingOverlays = false;
|
||||
|
|
|
@ -13,26 +13,18 @@
|
|||
|
||||
(function() { // BEGIN LOCAL_SCOPE
|
||||
|
||||
var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
||||
var button = toolBar.addButton({
|
||||
objectName: "mute",
|
||||
imageURL: Script.resolvePath("assets/images/tools/mic.svg"),
|
||||
visible: true,
|
||||
buttonState: 1,
|
||||
defaultState: 1,
|
||||
hoverState: 3,
|
||||
alpha: 0.9
|
||||
function muteURL() {
|
||||
return "icons/tablet-icons/" + (AudioDevice.getMuted() ? "mic-a.svg" : "mic-i.svg");
|
||||
}
|
||||
var button = tablet.addButton({
|
||||
icon: "icons/tablet-icons/mic-a.svg",
|
||||
text: "MUTE"
|
||||
});
|
||||
|
||||
function onMuteToggled() {
|
||||
// We could just toggle state, but we're less likely to get out of wack if we read the AudioDevice.
|
||||
// muted => button "on" state => 1. go figure.
|
||||
var state = AudioDevice.getMuted() ? 0 : 1;
|
||||
var hoverState = AudioDevice.getMuted() ? 2 : 3;
|
||||
button.writeProperty('buttonState', state);
|
||||
button.writeProperty('defaultState', state);
|
||||
button.writeProperty('hoverState', hoverState);
|
||||
button.editProperties({icon: muteURL()});
|
||||
}
|
||||
onMuteToggled();
|
||||
function onClicked(){
|
||||
|
@ -43,8 +35,8 @@ button.clicked.connect(onClicked);
|
|||
AudioDevice.muteToggled.connect(onMuteToggled);
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
toolBar.removeButton("mute");
|
||||
button.clicked.disconnect(onClicked);
|
||||
tablet.removeButton(button);
|
||||
AudioDevice.muteToggled.disconnect(onMuteToggled);
|
||||
});
|
||||
|
||||
|
|
|
@ -208,8 +208,8 @@ Window.snapshotShared.connect(snapshotShared);
|
|||
Window.processingGif.connect(processingGif);
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
tablet.removeButton(button);
|
||||
button.clicked.disconnect(onClicked);
|
||||
tablet.removeButton(button);
|
||||
Window.snapshotShared.disconnect(snapshotShared);
|
||||
Window.processingGif.disconnect(processingGif);
|
||||
});
|
||||
|
|
|
@ -26,18 +26,6 @@
|
|||
UIWebTablet = new WebTablet("qml/hifi/tablet/TabletRoot.qml", null, null, tabletLocation);
|
||||
UIWebTablet.register();
|
||||
HMD.tabletID = UIWebTablet.webEntityID;
|
||||
|
||||
var setUpTabletUI = function() {
|
||||
var root = UIWebTablet.getRoot();
|
||||
if (!root) {
|
||||
print("HERE no root yet");
|
||||
Script.setTimeout(setUpTabletUI, 100);
|
||||
return;
|
||||
}
|
||||
print("HERE got root", root);
|
||||
}
|
||||
|
||||
Script.setTimeout(setUpTabletUI, 100);
|
||||
}
|
||||
|
||||
function hideTabletUI() {
|
||||
|
|
Loading…
Reference in a new issue