mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:38:27 +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
|
// Cleanup the toolbar button and overlays when script is stopped
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
tablet.removeButton(button);
|
|
||||||
button.clicked.disconnect(Users.toggleIgnoreRadius);
|
button.clicked.disconnect(Users.toggleIgnoreRadius);
|
||||||
|
tablet.removeButton(button);
|
||||||
Users.ignoreRadiusEnabledChanged.disconnect(onBubbleToggled);
|
Users.ignoreRadiusEnabledChanged.disconnect(onBubbleToggled);
|
||||||
Users.enteredIgnoreRadius.disconnect(enteredIgnoreRadius);
|
Users.enteredIgnoreRadius.disconnect(enteredIgnoreRadius);
|
||||||
Overlays.deleteOverlay(bubbleOverlay);
|
Overlays.deleteOverlay(bubbleOverlay);
|
||||||
|
|
|
@ -478,7 +478,6 @@ var toolBar = (function () {
|
||||||
toolBar.writeProperty("shown", false);
|
toolBar.writeProperty("shown", false);
|
||||||
toolBar.writeProperty("shown", true);
|
toolBar.writeProperty("shown", true);
|
||||||
}
|
}
|
||||||
// toolBar.selectTool(activeButton, isActive);
|
|
||||||
lightOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_IN_EDIT_MODE));
|
lightOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_IN_EDIT_MODE));
|
||||||
Entities.setDrawZoneBoundaries(isActive && Menu.isOptionChecked(MENU_SHOW_ZONES_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);
|
DialogsManager.addressBarShown.connect(onAddressBarShown);
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
tablet.removeButton(button);
|
|
||||||
button.clicked.disconnect(onClicked);
|
button.clicked.disconnect(onClicked);
|
||||||
|
tablet.removeButton(button);
|
||||||
DialogsManager.addressBarShown.disconnect(onAddressBarShown);
|
DialogsManager.addressBarShown.disconnect(onAddressBarShown);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,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: "icons/tablet-icons/help-i.svg",
|
||||||
text: "HELP"
|
text: "HELP"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ function calcSpawnInfo() {
|
||||||
|
|
||||||
// ctor
|
// ctor
|
||||||
WebTablet = function (url, width, dpi, location, clientOnly) {
|
WebTablet = function (url, width, dpi, location, clientOnly) {
|
||||||
|
print(url);
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var ASPECT = 4.0 / 3.0;
|
var ASPECT = 4.0 / 3.0;
|
||||||
var WIDTH = width || DEFAULT_WIDTH;
|
var WIDTH = width || DEFAULT_WIDTH;
|
||||||
|
@ -75,7 +75,7 @@ WebTablet = function (url, width, dpi, location, clientOnly) {
|
||||||
tabletProperties.position = spawnInfo.position;
|
tabletProperties.position = spawnInfo.position;
|
||||||
tabletProperties.rotation = spawnInfo.rotation;
|
tabletProperties.rotation = spawnInfo.rotation;
|
||||||
}
|
}
|
||||||
|
this.tabletURL = url;
|
||||||
this.tabletEntityID = Entities.addEntity(tabletProperties, clientOnly);
|
this.tabletEntityID = Entities.addEntity(tabletProperties, clientOnly);
|
||||||
|
|
||||||
var WEB_ENTITY_Z_OFFSET = -0.01;
|
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}});
|
Entities.editEntity(_this.homeButtonEntity, {color: {red: 255, green: 255, blue: 0}});
|
||||||
_this.clicked = true;
|
_this.clicked = true;
|
||||||
}
|
}
|
||||||
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
tablet.gotoHomeScreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,30 +42,11 @@ function shouldShowWebTablet() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMarketplace(marketplaceID) {
|
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;
|
var url = MARKETPLACE_URL;
|
||||||
if (marketplaceID) {
|
if (marketplaceID) {
|
||||||
url = url + "/items/" + marketplaceID;
|
url = url + "/items/" + marketplaceID;
|
||||||
}
|
}
|
||||||
marketplaceWindow.setURL(url);
|
tablet.gotoWebScreen(url);
|
||||||
marketplaceWindow.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
marketplaceVisible = true;
|
marketplaceVisible = true;
|
||||||
UserActivityLogger.openedMarketplace();
|
UserActivityLogger.openedMarketplace();
|
||||||
}
|
}
|
||||||
|
@ -81,15 +62,15 @@ function hideTablet(tablet) {
|
||||||
Settings.setValue(persistenceKey, "");
|
Settings.setValue(persistenceKey, "");
|
||||||
}
|
}
|
||||||
function clearOldTablet() { // If there was a tablet from previous domain or session, kill it and let it be recreated
|
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, ""));
|
//var tablet = WebTablet.unpickle(Settings.getValue(persistenceKey, ""));
|
||||||
hideTablet(tablet);
|
//hideTablet(tablet);
|
||||||
}
|
}
|
||||||
function hideMarketplace() {
|
function hideMarketplace() {
|
||||||
if (marketplaceWindow.visible) {
|
if (marketplaceWindow.visible) {
|
||||||
marketplaceWindow.setVisible(false);
|
marketplaceWindow.setVisible(false);
|
||||||
marketplaceWindow.setURL("about:blank");
|
marketplaceWindow.setURL("about:blank");
|
||||||
} else if (marketplaceWebTablet) {
|
} else if (marketplaceWebTablet) {
|
||||||
hideTablet(marketplaceWebTablet);
|
//hideTablet(marketplaceWebTablet);
|
||||||
}
|
}
|
||||||
marketplaceVisible = false;
|
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({
|
var browseExamplesButton = tablet.addButton({
|
||||||
imageURL: toolIconUrl + "market.svg",
|
icon: "icons/tablet-icons/market-i.svg",
|
||||||
objectName: "marketplace",
|
text: "MARKET"
|
||||||
buttonState: 1,
|
|
||||||
defaultState: 1,
|
|
||||||
hoverState: 3,
|
|
||||||
alpha: 0.9
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateButtonState(visible) {
|
function updateButtonState(visible) {
|
||||||
browseExamplesButton.writeProperty('buttonState', visible ? 0 : 1);
|
//browseExamplesButton.writeProperty('buttonState', visible ? 0 : 1);
|
||||||
browseExamplesButton.writeProperty('defaultState', visible ? 0 : 1);
|
//browseExamplesButton.writeProperty('defaultState', visible ? 0 : 1);
|
||||||
browseExamplesButton.writeProperty('hoverState', visible ? 2 : 3);
|
//browseExamplesButton.writeProperty('hoverState', visible ? 2 : 3);
|
||||||
}
|
}
|
||||||
function onMarketplaceWindowVisibilityChanged() {
|
function onMarketplaceWindowVisibilityChanged() {
|
||||||
updateButtonState(marketplaceWindow.visible);
|
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.
|
// but the HUD version stays around, so lets do the same.
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
toolBar.removeButton("marketplace");
|
|
||||||
browseExamplesButton.clicked.disconnect(onClick);
|
browseExamplesButton.clicked.disconnect(onClick);
|
||||||
|
tablet.removeButton(browseExamplesButton);
|
||||||
marketplaceWindow.visibleChanged.disconnect(onMarketplaceWindowVisibilityChanged);
|
marketplaceWindow.visibleChanged.disconnect(onMarketplaceWindowVisibilityChanged);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -24,18 +24,18 @@ var ASSETS_PATH = Script.resolvePath("assets");
|
||||||
var TOOLS_PATH = Script.resolvePath("assets/images/tools/");
|
var TOOLS_PATH = Script.resolvePath("assets/images/tools/");
|
||||||
|
|
||||||
function buttonImageURL() {
|
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
|
// setup the mod button and add it to the toolbar
|
||||||
var button = toolbar.addButton({
|
var button = tablet.addButton({
|
||||||
icon: buttonImageURL(),
|
icon: "icons/tablet-icons/ignore-i.svg",
|
||||||
text: "KICK"
|
text: "KICK"
|
||||||
});
|
});
|
||||||
|
|
||||||
// if this user's kick permissions change, change the state of the button in the HUD
|
// if this user's kick permissions change, change the state of the button in the HUD
|
||||||
Users.canKickChanged.connect(function(canKick){
|
Users.canKickChanged.connect(function(canKick){
|
||||||
button.editProperties({icon: buttonImageURL()});
|
button.editProperties({text: buttonImageURL()});
|
||||||
});
|
});
|
||||||
|
|
||||||
var isShowingOverlays = false;
|
var isShowingOverlays = false;
|
||||||
|
|
|
@ -13,26 +13,18 @@
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(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({
|
function muteURL() {
|
||||||
objectName: "mute",
|
return "icons/tablet-icons/" + (AudioDevice.getMuted() ? "mic-a.svg" : "mic-i.svg");
|
||||||
imageURL: Script.resolvePath("assets/images/tools/mic.svg"),
|
}
|
||||||
visible: true,
|
var button = tablet.addButton({
|
||||||
buttonState: 1,
|
icon: "icons/tablet-icons/mic-a.svg",
|
||||||
defaultState: 1,
|
text: "MUTE"
|
||||||
hoverState: 3,
|
|
||||||
alpha: 0.9
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function onMuteToggled() {
|
function onMuteToggled() {
|
||||||
// We could just toggle state, but we're less likely to get out of wack if we read the AudioDevice.
|
button.editProperties({icon: muteURL()});
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
onMuteToggled();
|
onMuteToggled();
|
||||||
function onClicked(){
|
function onClicked(){
|
||||||
|
@ -43,8 +35,8 @@ button.clicked.connect(onClicked);
|
||||||
AudioDevice.muteToggled.connect(onMuteToggled);
|
AudioDevice.muteToggled.connect(onMuteToggled);
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
toolBar.removeButton("mute");
|
|
||||||
button.clicked.disconnect(onClicked);
|
button.clicked.disconnect(onClicked);
|
||||||
|
tablet.removeButton(button);
|
||||||
AudioDevice.muteToggled.disconnect(onMuteToggled);
|
AudioDevice.muteToggled.disconnect(onMuteToggled);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -208,8 +208,8 @@ Window.snapshotShared.connect(snapshotShared);
|
||||||
Window.processingGif.connect(processingGif);
|
Window.processingGif.connect(processingGif);
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
tablet.removeButton(button);
|
|
||||||
button.clicked.disconnect(onClicked);
|
button.clicked.disconnect(onClicked);
|
||||||
|
tablet.removeButton(button);
|
||||||
Window.snapshotShared.disconnect(snapshotShared);
|
Window.snapshotShared.disconnect(snapshotShared);
|
||||||
Window.processingGif.disconnect(processingGif);
|
Window.processingGif.disconnect(processingGif);
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,18 +26,6 @@
|
||||||
UIWebTablet = new WebTablet("qml/hifi/tablet/TabletRoot.qml", null, null, tabletLocation);
|
UIWebTablet = new WebTablet("qml/hifi/tablet/TabletRoot.qml", null, null, tabletLocation);
|
||||||
UIWebTablet.register();
|
UIWebTablet.register();
|
||||||
HMD.tabletID = UIWebTablet.webEntityID;
|
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() {
|
function hideTabletUI() {
|
||||||
|
|
Loading…
Reference in a new issue