Fix MS14796: Fix position of tablet close button highlight

This commit is contained in:
Zach Fox 2018-05-31 15:13:23 -07:00 committed by Dante Ruiz
parent c18c2358d6
commit b9604fdb9d
2 changed files with 11 additions and 7 deletions

View file

@ -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
});

View file

@ -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 }
});