From 9c0104a060d363a985786a8e89f591b5ce16fa83 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 23 Feb 2017 14:55:52 -0800 Subject: [PATCH] don't use Entities.getEntityProperties on tablet when it's an overlay --- scripts/system/libraries/WebTablet.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index 26b6f82520..c4b41bcab5 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -193,7 +193,16 @@ WebTablet = function (url, width, dpi, hand, clientOnly) { }; this.getLocation = function() { - return Entities.getEntityProperties(_this.tabletEntityID, ["localPosition", "localRotation"]); + if (this.tabletIsOverlay) { + var location = Overlays.getProperty(this.tabletEntityID, "localPosition"); + var orientation = Overlays.getProperty(this.tabletEntityID, "localOrientation"); + return { + localPosition: location, + localRotation: orientation + }; + } else { + return Entities.getEntityProperties(_this.tabletEntityID, ["localPosition", "localRotation"]); + } }; this.clicked = false; @@ -461,7 +470,11 @@ WebTablet.prototype.mousePressEvent = function (event) { this.dragging = true; var invCameraXform = new Xform(Camera.orientation, Camera.position).inv(); this.initialLocalIntersectionPoint = invCameraXform.xformPoint(entityPickResults.intersection); - this.initialLocalPosition = Entities.getEntityProperties(this.tabletEntityID, ["localPosition"]).localPosition; + if (this.tabletIsOverlay) { + this.initialLocalPosition = Overlays.getProperty(this.tabletEntityID, "localPosition"); + } else { + this.initialLocalPosition = Entities.getEntityProperties(this.tabletEntityID, ["localPosition"]).localPosition; + } } } };