From b9604fdb9d7d2df63528e3c3156980ec7ed455fc Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 31 May 2018 15:13:23 -0700 Subject: [PATCH] Fix MS14796: Fix position of tablet close button highlight --- scripts/system/libraries/WebTablet.js | 10 ++++++---- scripts/system/libraries/utils.js | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index 783b91f5f0..31376f57fa 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -153,12 +153,14 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) { visible: visible }); - var HOME_BUTTON_Y_OFFSET = (tabletHeight / 2) - (tabletHeight / 20) + 0.003 * sensorScaleFactor; + var HOME_BUTTON_X_OFFSET = 0.0005; + var HOME_BUTTON_Y_OFFSET = (tabletHeight / 2) - (tabletHeight / 20) + (HMD.active ? 0.005 : 0.0055) * sensorScaleFactor; + var HOME_BUTTON_Z_OFFSET = -WEB_ENTITY_Z_OFFSET + 0.0040 - (HMD.active ? 0.005 : 0.0018); // FIXME: Circle3D overlays currently at the wrong dimensions, so we need to account for that here var homeButtonDim = 4.0 * tabletScaleFactor / 3.0; this.homeButtonID = Overlays.addOverlay("circle3d", { name: "homeButton", - localPosition: { x: 0.0, y: -HOME_BUTTON_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET }, + localPosition: { x: HOME_BUTTON_X_OFFSET, y: -HOME_BUTTON_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET }, localRotation: { x: 0, y: 1, z: 0, w: 0}, dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }, solid: true, @@ -171,7 +173,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) { this.homeButtonHighlightID = Overlays.addOverlay("circle3d", { name: "homeButtonHighlight", - localPosition: { x: 0, y: -HOME_BUTTON_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET }, + localPosition: { x: HOME_BUTTON_X_OFFSET, y: -HOME_BUTTON_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET }, localRotation: { x: 0, y: 1, z: 0, w: 0 }, dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim }, color: { red: 255, green: 255, blue: 255 }, @@ -180,7 +182,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) { ignoreIntersection: true, alpha: 1.0, visible: visible, - drawInFront: false, + drawInFront: true, parentID: this.tabletEntityID, parentJointIndex: -1 }); diff --git a/scripts/system/libraries/utils.js b/scripts/system/libraries/utils.js index 538850ff42..2732b05269 100644 --- a/scripts/system/libraries/utils.js +++ b/scripts/system/libraries/utils.js @@ -413,17 +413,19 @@ resizeTablet = function (width, newParentJointIndex, sensorToWorldScaleOverride) }); // update homeButton - var HOME_BUTTON_Y_OFFSET = ((tabletHeight / 2) - (tabletHeight / 20) + 0.003 * sensorScaleFactor) * sensorScaleOffsetOverride; + var HOME_BUTTON_X_OFFSET = 0.0005; + var HOME_BUTTON_Y_OFFSET = ((tabletHeight / 2) - (tabletHeight / 20) + (HMD.active ? 0.005 : 0.0055) * sensorScaleFactor) * sensorScaleOffsetOverride; + var HOME_BUTTON_Z_OFFSET = -WEB_ENTITY_Z_OFFSET + 0.0040 - (HMD.active ? 0.005 : 0.0018); // FIXME: Circle3D overlays currently at the wrong dimensions, so we need to account for that here var homeButtonDim = 4.0 * tabletScaleFactor / 3.0; Overlays.editOverlay(HMD.homeButtonID, { - localPosition: { x: 0, y: -HOME_BUTTON_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET }, + localPosition: { x: HOME_BUTTON_X_OFFSET, y: -HOME_BUTTON_Y_OFFSET, z: HOME_BUTTON_Z_OFFSET }, localRotation: Quat.angleAxis(180, Vec3.UNIT_Y), dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim } }); Overlays.editOverlay(HMD.homeButtonHighlightID, { - localPosition: { x: 0, y: -HOME_BUTTON_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET }, + localPosition: { x: HOME_BUTTON_X_OFFSET, y: -HOME_BUTTON_Y_OFFSET, z: HOME_BUTTON_Z_OFFSET }, localRotation: Quat.angleAxis(180, Vec3.UNIT_Y), dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim } });