fixed home buttons issues

This commit is contained in:
Dante Ruiz 2016-12-16 17:18:46 +00:00
parent 8b99fa90e8
commit 571783b90d
2 changed files with 13 additions and 3 deletions

View file

@ -8,6 +8,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
Script.include(Script.resolvePath("../libraries/utils.js"));
var RAD_TO_DEG = 180 / Math.PI;
var X_AXIS = {x: 1, y: 0, z: 0};
var Y_AXIS = {x: 0, y: 1, z: 0};
@ -15,7 +17,7 @@ var DEFAULT_DPI = 32;
var DEFAULT_WIDTH = 0.5;
var TABLET_URL = "https://s3.amazonaws.com/hifi-public/tony/tablet.fbx";
var sound = SoundCache.getSound(Script.resolvePath("assets/sounds/hello.wav"));
// returns object with two fields:
// * position - position in front of the user
// * rotation - rotation of entity so it faces the user.
@ -104,12 +106,18 @@ WebTablet = function (url, width, dpi, location, clientOnly) {
dimensions: {x: 0.05, y: 0.05, z: 0.05},
parentID: this.tabletEntityID,
script: "https://people.ucsc.edu/~druiz4/scripts/homeButton.js"
}, clientOnly);
}, clientOnly);
setEntityCustomData('grabbableKey', this.homeButtonEntity, {wantsTrigger: true});
this.receive = function (channel, senderID, senderUUID, localOnly) {
if (_this.homeButtonEntity == senderID) {
//var homePosition = Entities.getEntityProperties(_this.homeButtonEntity, ["position"]);
if (_this.clicked) {
Entities.editEntity(_this.homeButtonEntity, {color: {red: 0, green: 255, blue: 255}});
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}});

View file

@ -24,6 +24,7 @@
tabletShown = true;
print("show tablet-ui");
UIWebTablet = new WebTablet("qml/hifi/tablet/Tablet.qml", null, null, tabletLocation);
UIWebTablet.register();
HMD.tabletID = UIWebTablet.webEntityID;
var setUpTabletUI = function() {
@ -48,6 +49,7 @@
}
tabletLocation = UIWebTablet.getLocation();
UIWebTablet.unregister();
UIWebTablet.destroy();
UIWebTablet = null;
HMD.tabletID = null;