mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
adding tablet-goto.js
This commit is contained in:
parent
6bc685b02a
commit
580216c3d2
2 changed files with 66 additions and 4 deletions
|
@ -18,14 +18,12 @@ var button;
|
|||
var buttonName = "GOTO";
|
||||
var toolBar = null;
|
||||
var tablet = null;
|
||||
var ADDRESS_DIALOG_QML_SOURCE = "TabletAddressDialog.qml";
|
||||
function onAddressBarShown(visible) {
|
||||
//button.editProperties({isActive: visible});
|
||||
button.editProperties({isActive: visible});
|
||||
}
|
||||
|
||||
function onClicked(){
|
||||
//DialogsManager.toggleAddressBar();
|
||||
tablet.loadQMLSource(ADDRESS_DIALOG_QML_SOURCE);
|
||||
DialogsManager.toggleAddressBar();
|
||||
}
|
||||
|
||||
if (Settings.getValue("HUDUIEnabled")) {
|
||||
|
|
64
scripts/system/tablet-goto.js
Normal file
64
scripts/system/tablet-goto.js
Normal file
|
@ -0,0 +1,64 @@
|
|||
"use strict";
|
||||
|
||||
//
|
||||
// goto.js
|
||||
// scripts/system/
|
||||
//
|
||||
// Created by Dante Ruiz on 8 February 2017
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
(function() { // BEGIN LOCAL_SCOPE
|
||||
var gotoQmlSource = "TabletAddressDialog.qml";
|
||||
var button;
|
||||
var buttonName = "GOTO";
|
||||
var toolBar = null;
|
||||
var tablet = null;
|
||||
function onAddressBarShown(visible) {
|
||||
if (toolBar) {
|
||||
button.editProperties({isActive: visible});
|
||||
}
|
||||
}
|
||||
|
||||
function onClicked(){
|
||||
if (toolBar) {
|
||||
DialogsManager.toggleAddressBar();
|
||||
} else {
|
||||
tablet.loadQMLSource(gotoQmlSource);
|
||||
}
|
||||
}
|
||||
if (Settings.getValue("HUDUIEnabled")) {
|
||||
toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
|
||||
button = toolBar.addButton({
|
||||
objectName: buttonName,
|
||||
imageURL: Script.resolvePath("assets/images/tools/directory.svg"),
|
||||
visible: true,
|
||||
alpha: 0.9
|
||||
});
|
||||
} else {
|
||||
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
button = tablet.addButton({
|
||||
icon: "icons/tablet-icons/goto-i.svg",
|
||||
text: buttonName,
|
||||
sortOrder: 8
|
||||
});
|
||||
}
|
||||
|
||||
button.clicked.connect(onClicked);
|
||||
DialogsManager.addressBarShown.connect(onAddressBarShown);
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
button.clicked.disconnect(onClicked);
|
||||
if (tablet) {
|
||||
tablet.removeButton(button);
|
||||
}
|
||||
if (toolBar) {
|
||||
toolBar.removeButton(buttonName);
|
||||
}
|
||||
DialogsManager.addressBarShown.disconnect(onAddressBarShown);
|
||||
});
|
||||
|
||||
}()); // END LOCAL_SCOPE
|
Loading…
Reference in a new issue