mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Basic address bar toggle button.
This commit is contained in:
parent
af6ec8d8bd
commit
247286c71f
2 changed files with 48 additions and 0 deletions
|
@ -13,6 +13,7 @@ Script.load("system/progress.js");
|
|||
Script.load("system/away.js");
|
||||
Script.load("system/users.js");
|
||||
Script.load("system/examples.js");
|
||||
Script.load("system/goto.js");
|
||||
Script.load("system/edit.js");
|
||||
Script.load("system/selectAudioDevice.js");
|
||||
Script.load("system/notifications.js");
|
||||
|
|
47
scripts/system/goto.js
Normal file
47
scripts/system/goto.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
//
|
||||
// goto.js
|
||||
// scripts/system/
|
||||
//
|
||||
// Created by Howard Stearns on 2 Jun 2016
|
||||
// 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
|
||||
//
|
||||
|
||||
Script.include("libraries/toolBars.js");
|
||||
|
||||
function initialPosition(windowDimensions, toolbar) {
|
||||
return {
|
||||
x: windowDimensions.x / 2 - Tool.IMAGE_WIDTH,
|
||||
y: windowDimensions.y
|
||||
};
|
||||
}
|
||||
var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.goto.toolbar", initialPosition, {
|
||||
x: -Tool.IMAGE_WIDTH / 2,
|
||||
y: -Tool.IMAGE_HEIGHT
|
||||
});
|
||||
var button = toolBar.addTool({
|
||||
imageURL: Script.resolvePath("assets/images/tools/directory-01.svg"),
|
||||
subImage: {
|
||||
x: 0,
|
||||
y: Tool.IMAGE_WIDTH,
|
||||
width: Tool.IMAGE_WIDTH,
|
||||
height: Tool.IMAGE_HEIGHT
|
||||
},
|
||||
width: Tool.IMAGE_WIDTH,
|
||||
height: Tool.IMAGE_HEIGHT,
|
||||
alpha: 0.9,
|
||||
visible: true,
|
||||
showButtonDown: true
|
||||
});
|
||||
function onMousePress (event) {
|
||||
if (event.isLeftButton && button === toolBar.clicked(Overlays.getOverlayAtPoint(event))) {
|
||||
DialogsManager.toggleAddressBar();
|
||||
}
|
||||
};
|
||||
Controller.mousePressEvent.connect(onMousePress)
|
||||
Script.scriptEnding.connect(function () {
|
||||
Controller.mousePressEvent.disconnect(onMousePress)
|
||||
toolBar.cleanup();
|
||||
});
|
Loading…
Reference in a new issue