mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 20:17:01 +02:00
moving buttons to tablet
This commit is contained in:
parent
c4d1bee0e3
commit
c0e82d3e05
4 changed files with 40 additions and 25 deletions
|
@ -16,7 +16,7 @@
|
||||||
(function () { // BEGIN LOCAL_SCOPE
|
(function () { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
// grab the toolbar
|
// grab the toolbar
|
||||||
var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
// Used for animating and disappearing the bubble
|
// Used for animating and disappearing the bubble
|
||||||
var bubbleOverlayTimestamp;
|
var bubbleOverlayTimestamp;
|
||||||
// Used for flashing the HUD button upon activation
|
// Used for flashing the HUD button upon activation
|
||||||
|
@ -91,9 +91,9 @@
|
||||||
|
|
||||||
// Used to set the state of the bubble HUD button
|
// Used to set the state of the bubble HUD button
|
||||||
function writeButtonProperties(parameter) {
|
function writeButtonProperties(parameter) {
|
||||||
button.writeProperty('buttonState', parameter ? 0 : 1);
|
//button.writeProperty('buttonState', parameter ? 0 : 1);
|
||||||
button.writeProperty('defaultState', parameter ? 0 : 1);
|
//button.writeProperty('defaultState', parameter ? 0 : 1);
|
||||||
button.writeProperty('hoverState', parameter ? 2 : 3);
|
//button.writeProperty('hoverState', parameter ? 2 : 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The bubble script's update function
|
// The bubble script's update function
|
||||||
|
@ -167,12 +167,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the bubble button and add it to the toolbar
|
// Setup the bubble button and add it to the toolbar
|
||||||
var button = toolbar.addButton({
|
var button = tablet.addButton({
|
||||||
|
color: "#63b0ff",
|
||||||
|
text: "BUBBLE"});
|
||||||
|
/*var button = toolbar.addButton({
|
||||||
objectName: 'bubble',
|
objectName: 'bubble',
|
||||||
imageURL: buttonImageURL(),
|
imageURL: buttonImageURL(),
|
||||||
visible: true,
|
visible: true,
|
||||||
alpha: 0.9
|
alpha: 0.9
|
||||||
});
|
});*/
|
||||||
onBubbleToggled();
|
onBubbleToggled();
|
||||||
|
|
||||||
button.clicked.connect(Users.toggleIgnoreRadius);
|
button.clicked.connect(Users.toggleIgnoreRadius);
|
||||||
|
@ -181,7 +184,7 @@
|
||||||
|
|
||||||
// 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 () {
|
||||||
toolbar.removeButton('bubble');
|
tablet.removeButton('bubble');
|
||||||
button.clicked.disconnect(Users.toggleIgnoreRadius);
|
button.clicked.disconnect(Users.toggleIgnoreRadius);
|
||||||
Users.ignoreRadiusEnabledChanged.disconnect(onBubbleToggled);
|
Users.ignoreRadiusEnabledChanged.disconnect(onBubbleToggled);
|
||||||
Users.enteredIgnoreRadius.disconnect(enteredIgnoreRadius);
|
Users.enteredIgnoreRadius.disconnect(enteredIgnoreRadius);
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
var EDIT_TOGGLE_BUTTON = "com.highfidelity.interface.system.editButton";
|
var EDIT_TOGGLE_BUTTON = "com.highfidelity.interface.system.editButton";
|
||||||
var SYSTEM_TOOLBAR = "com.highfidelity.interface.toolbar.system";
|
var SYSTEM_TOOLBAR = "com.highfidelity.interface.toolbar.system";
|
||||||
var EDIT_TOOLBAR = "com.highfidelity.interface.toolbar.edit";
|
var EDIT_TOOLBAR = "com.highfidelity.interface.toolbar.edit";
|
||||||
|
|
||||||
|
|
||||||
Script.include([
|
Script.include([
|
||||||
"libraries/stringHelpers.js",
|
"libraries/stringHelpers.js",
|
||||||
|
@ -171,7 +171,8 @@ var toolBar = (function () {
|
||||||
var that = {},
|
var that = {},
|
||||||
toolBar,
|
toolBar,
|
||||||
systemToolbar,
|
systemToolbar,
|
||||||
activeButton;
|
activeButton,
|
||||||
|
tablet;
|
||||||
|
|
||||||
function createNewEntity(properties) {
|
function createNewEntity(properties) {
|
||||||
Settings.setValue(EDIT_SETTING, false);
|
Settings.setValue(EDIT_SETTING, false);
|
||||||
|
@ -231,7 +232,12 @@ var toolBar = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
systemToolbar = Toolbars.getToolbar(SYSTEM_TOOLBAR);
|
systemToolbar = Toolbars.getToolbar(SYSTEM_TOOLBAR);
|
||||||
activeButton = systemToolbar.addButton({
|
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
activeButton = tablet.addButton({
|
||||||
|
color: "#63d0ff",
|
||||||
|
text: "EDIT"
|
||||||
|
});
|
||||||
|
/*activeButton = systemToolbar.addButton({
|
||||||
objectName: EDIT_TOGGLE_BUTTON,
|
objectName: EDIT_TOGGLE_BUTTON,
|
||||||
imageURL: TOOLS_PATH + "edit.svg",
|
imageURL: TOOLS_PATH + "edit.svg",
|
||||||
visible: true,
|
visible: true,
|
||||||
|
@ -239,7 +245,7 @@ var toolBar = (function () {
|
||||||
buttonState: 1,
|
buttonState: 1,
|
||||||
hoverState: 3,
|
hoverState: 3,
|
||||||
defaultState: 1
|
defaultState: 1
|
||||||
});
|
});*/
|
||||||
activeButton.clicked.connect(function() {
|
activeButton.clicked.connect(function() {
|
||||||
that.toggle();
|
that.toggle();
|
||||||
});
|
});
|
||||||
|
@ -706,6 +712,7 @@ function mouseClickEvent(event) {
|
||||||
var foundEntity = result.entityID;
|
var foundEntity = result.entityID;
|
||||||
|
|
||||||
properties = Entities.getEntityProperties(foundEntity);
|
properties = Entities.getEntityProperties(foundEntity);
|
||||||
|
|
||||||
if (isLocked(properties)) {
|
if (isLocked(properties)) {
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("Model locked " + properties.id);
|
print("Model locked " + properties.id);
|
||||||
|
|
|
@ -13,10 +13,12 @@
|
||||||
|
|
||||||
(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 = tablet.addButton({
|
||||||
var button = toolBar.addButton({
|
color: "63d0ff",
|
||||||
|
text:"GOTO"})
|
||||||
|
/*var button = toolBar.addButton({
|
||||||
objectName: "goto",
|
objectName: "goto",
|
||||||
imageURL: Script.resolvePath("assets/images/tools/directory.svg"),
|
imageURL: Script.resolvePath("assets/images/tools/directory.svg"),
|
||||||
visible: true,
|
visible: true,
|
||||||
|
@ -24,12 +26,12 @@ var button = toolBar.addButton({
|
||||||
defaultState: 1,
|
defaultState: 1,
|
||||||
hoverState: 3,
|
hoverState: 3,
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
});
|
});*/
|
||||||
|
|
||||||
function onAddressBarShown(visible) {
|
function onAddressBarShown(visible) {
|
||||||
button.writeProperty('buttonState', visible ? 0 : 1);
|
//button.writeProperty('buttonState', visible ? 0 : 1);
|
||||||
button.writeProperty('defaultState', visible ? 0 : 1);
|
//button.writeProperty('defaultState', visible ? 0 : 1);
|
||||||
button.writeProperty('hoverState', visible ? 2 : 3);
|
//button.writeProperty('hoverState', visible ? 2 : 3);
|
||||||
}
|
}
|
||||||
function onClicked(){
|
function onClicked(){
|
||||||
DialogsManager.toggleAddressBar();
|
DialogsManager.toggleAddressBar();
|
||||||
|
|
|
@ -35,15 +35,15 @@ function updateControllerDisplay() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var button;
|
var button;
|
||||||
// Independent and Entity mode make people sick. Third Person and Mirror have traps that we need to work through.
|
// Independent and Entity mode make people sick. Third Person and Mirror have traps that we need to work through.
|
||||||
// Disable them in hmd.
|
// Disable them in hmd.
|
||||||
var desktopOnlyViews = ['Mirror', 'Independent Mode', 'Entity Mode'];
|
var desktopOnlyViews = ['Mirror', 'Independent Mode', 'Entity Mode'];
|
||||||
function onHmdChanged(isHmd) {
|
function onHmdChanged(isHmd) {
|
||||||
button.writeProperty('buttonState', isHmd ? 0 : 1);
|
//button.writeProperty('buttonState', isHmd ? 0 : 1);
|
||||||
button.writeProperty('defaultState', isHmd ? 0 : 1);
|
//button.writeProperty('defaultState', isHmd ? 0 : 1);
|
||||||
button.writeProperty('hoverState', isHmd ? 2 : 3);
|
//button.writeProperty('hoverState', isHmd ? 2 : 3);
|
||||||
desktopOnlyViews.forEach(function (view) {
|
desktopOnlyViews.forEach(function (view) {
|
||||||
Menu.setMenuEnabled("View>" + view, !isHmd);
|
Menu.setMenuEnabled("View>" + view, !isHmd);
|
||||||
});
|
});
|
||||||
|
@ -54,14 +54,17 @@ function onClicked(){
|
||||||
Menu.setIsOptionChecked(isDesktop ? headset : desktopMenuItemName, true);
|
Menu.setIsOptionChecked(isDesktop ? headset : desktopMenuItemName, true);
|
||||||
}
|
}
|
||||||
if (headset) {
|
if (headset) {
|
||||||
button = toolBar.addButton({
|
/*button = toolBar.addButton({
|
||||||
objectName: "hmdToggle",
|
objectName: "hmdToggle",
|
||||||
imageURL: Script.resolvePath("assets/images/tools/switch.svg"),
|
imageURL: Script.resolvePath("assets/images/tools/switch.svg"),
|
||||||
visible: true,
|
visible: true,
|
||||||
hoverState: 2,
|
hoverState: 2,
|
||||||
defaultState: 0,
|
defaultState: 0,
|
||||||
alpha: 0.9
|
alpha: 0.9
|
||||||
});
|
});*/
|
||||||
|
button = tablet.addButton({
|
||||||
|
color: "#63d0ff",
|
||||||
|
text: "SWITCH"});
|
||||||
onHmdChanged(HMD.active);
|
onHmdChanged(HMD.active);
|
||||||
|
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
|
@ -69,8 +72,8 @@ if (headset) {
|
||||||
Camera.modeUpdated.connect(updateControllerDisplay);
|
Camera.modeUpdated.connect(updateControllerDisplay);
|
||||||
|
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
toolBar.removeButton("hmdToggle");
|
|
||||||
button.clicked.disconnect(onClicked);
|
button.clicked.disconnect(onClicked);
|
||||||
|
tablet.removeButton(button);
|
||||||
HMD.displayModeChanged.disconnect(onHmdChanged);
|
HMD.displayModeChanged.disconnect(onHmdChanged);
|
||||||
Camera.modeUpdated.disconnect(updateControllerDisplay);
|
Camera.modeUpdated.disconnect(updateControllerDisplay);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue