add a tablet button for photobooth

This commit is contained in:
Faye Li 2017-02-15 14:19:03 -08:00
parent 5ec3bbde52
commit 18db5f1724

View file

@ -1,9 +1,28 @@
//
// photobooth.js
// scripts/developer/utilities/render/photobooth
//
// Created by Howard Stearns on 2 Nov 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
//
/* globals Tablet, Toolbars, Script, HMD, Controller, Menu */
(function () {
var SNAPSHOT_DELAY = 500; // 500ms
var PHOTOBOOTH_WINDOW_HTML_URL = Script.resolvePath("./html/photobooth.html");
var PHOTOBOOTH_SETUP_JSON_URL = Script.resolvePath("./photoboothSetup.json");
var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
var MODEL_BOUNDING_BOX_DIMENSIONS = {x: 1.0174,y: 1.1925,z: 1.0165};
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: "icons/tablet-icons/snap-i.svg",
text: "PHOTOBOOTH"
});
function onClicked() {
PhotoBooth.init();
}
button.clicked.connect(onClicked);
var PhotoBooth = {};
PhotoBooth.init = function () {
@ -96,7 +115,6 @@
};
var main = function () {
PhotoBooth.init();
var photoboothWindowListener = {};
photoboothWindowListener.onLoad = function (event) {
@ -172,6 +190,7 @@
function cleanup() {
Camera.mode = "first person";
PhotoBooth.destroy();
tablet.removeButton(button);
}
Script.scriptEnding.connect(cleanup);
}());