From 8f36090884f79935ecbf24c413cfe8de73b1f238 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 16 Dec 2016 21:45:53 +0000 Subject: [PATCH] removed tabs and also remove script from host --- scripts/system/libraries/WebTablet.js | 16 ++++++------- scripts/system/tablet-ui/HomeButton.js | 32 ++++++++++++++++++++++++++ scripts/system/tablet-ui/tabletUI.js | 4 ++-- 3 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 scripts/system/tablet-ui/HomeButton.js diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index 10c8e48d1d..0dc52c2c1c 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -98,28 +98,26 @@ WebTablet = function (url, width, dpi, location, clientOnly) { this.createWebEntity(url); + this.homeButtonEntity = Entities.addEntity({ name: "homeButton", type: "Sphere", localPosition: {x: 0, y: HOME_BUTTON_Y_OFFSET, z: 0}, dimensions: {x: 0.05, y: 0.05, z: 0.05}, parentID: this.tabletEntityID, - script: "https://people.ucsc.edu/~druiz4/scripts/homeButton.js" + script: Script.resolvePath("../tablet-ui/HomeButton.js") }, clientOnly); - - setEntityCustomData('grabbableKey', this.homeButtonEntity, {wantsTrigger: true}); - - + setEntityCustomData('grabbableKey', this.homeButtonEntity, {wantsTrigger: true}); this.receive = function (channel, senderID, senderUUID, localOnly) { if (_this.homeButtonEntity == senderID) { if (_this.clicked) { - Entities.editEntity(_this.homeButtonEntity, {color: {red: 0, green: 255, blue: 255}}); - _this.clicked = false; + Entities.editEntity(_this.homeButtonEntity, {color: {red: 0, green: 255, blue: 255}}); + _this.clicked = false; } else { - Entities.editEntity(_this.homeButtonEntity, {color: {red: 255, green: 255, blue: 0}}); - _this.clicked = true; + Entities.editEntity(_this.homeButtonEntity, {color: {red: 255, green: 255, blue: 0}}); + _this.clicked = true; } } } diff --git a/scripts/system/tablet-ui/HomeButton.js b/scripts/system/tablet-ui/HomeButton.js new file mode 100644 index 0000000000..e3b4c78329 --- /dev/null +++ b/scripts/system/tablet-ui/HomeButton.js @@ -0,0 +1,32 @@ +// +// HomeButton.js +// +// Created by Dante Ruiz on 12/6/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 +// + +(function(){ + _this = this; + + this.preload = function(entityID) { + print(entityID); + this.entityID = entityID; + } + + this.clickDownOnEntity = function(entityID, mouseEvent) { + Messages.sendLocalMessage("home", _this.entityID); + } + + this.startNearTrigger = function() { + Messages.sendLocalMessage("home", _this.entityID); + } + + + this.startFarTrigger = function() { + Messages.sendLocalMessage("home", _this.entityID); + } + +}); diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index c49ed54345..19eb7f3726 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -24,7 +24,7 @@ tabletShown = true; print("show tablet-ui"); UIWebTablet = new WebTablet("qml/hifi/tablet/Tablet.qml", null, null, tabletLocation); - UIWebTablet.register(); + UIWebTablet.register(); HMD.tabletID = UIWebTablet.webEntityID; var setUpTabletUI = function() { @@ -49,7 +49,7 @@ } tabletLocation = UIWebTablet.getLocation(); - UIWebTablet.unregister(); + UIWebTablet.unregister(); UIWebTablet.destroy(); UIWebTablet = null; HMD.tabletID = null;