From 7613bddefa0b52d5e75ef6dea8dbdb76d2cfc496 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 13 Nov 2017 14:26:34 -0800 Subject: [PATCH] fixing some issues with hud module --- .../controllerModules/hudOverlayPointer.js | 20 +++++++++++++++---- .../controllerModules/tabletStylusInput.js | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/system/controllers/controllerModules/hudOverlayPointer.js b/scripts/system/controllers/controllerModules/hudOverlayPointer.js index 7d86087cde..38ee29ae3b 100644 --- a/scripts/system/controllers/controllerModules/hudOverlayPointer.js +++ b/scripts/system/controllers/controllerModules/hudOverlayPointer.js @@ -26,6 +26,7 @@ var HUD_LASER_OFFSET = 2; function HudOverlayPointer(hand) { this.hand = hand; + this.running = false; this.reticleMinX = MARGIN; this.reticleMaxX; this.reticleMinY = MARGIN; @@ -64,8 +65,13 @@ return (rayPick.objectID === HMD.tabletScreenID || rayPick.objectID === HMD.homeButtonID); }; + this.getOtherModule = function() { + return this.hand === RIGHT_HAND ? leftHudOverlayPointer : rightHudOverlayPointer; + }; + this.processLaser = function(controllerData) { var controllerLocation = controllerData.controllerLocations[this.hand]; + var otherModuleRunning = this.getOtherModule().running; if ((controllerData.triggerValues[this.hand] < ControllerDispatcherUtils.TRIGGER_ON_VALUE || !controllerLocation.valid) || this.pointingAtTablet(controllerData)) { return false; @@ -81,11 +87,17 @@ }; this.isReady = function (controllerData) { - if (this.processLaser(controllerData)) { - return ControllerDispatcherUtils.makeRunningValues(true, [], []); - } else { - return ControllerDispatcherUtils.makeRunningValues(false, [], []); + var otherModuleRunning = this.getOtherModule().running; + if (!otherModuleRunning) { + if (this.processLaser(controllerData)) { + this.running = true; + return ControllerDispatcherUtils.makeRunningValues(true, [], []); + } else { + this.running = false; + return ControllerDispatcherUtils.makeRunningValues(false, [], []); + } } + return ControllerDispatcherUtils.makeRunningValues(false, [], []); }; this.run = function (controllerData, deltaTime) { diff --git a/scripts/system/controllers/controllerModules/tabletStylusInput.js b/scripts/system/controllers/controllerModules/tabletStylusInput.js index d2fcb94804..1294e28c47 100644 --- a/scripts/system/controllers/controllerModules/tabletStylusInput.js +++ b/scripts/system/controllers/controllerModules/tabletStylusInput.js @@ -20,7 +20,7 @@ Script.include("/~/system/libraries/controllers.js"); var stylusTargetIDs = []; for (var index = 0; index < stylusTargets.length; index++) { var stylusTarget = stylusTargets[index]; - if (stylusTarget.distance <= maxNormalDistance) { + if (stylusTarget.distance <= maxNormalDistance && stylusTarget.id !== HMD.tabletID) { stylusTargetIDs.push(stylusTarget.id); } }