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