History

fixing some issues with hud module

Dante Ruiz committed 9 years ago

Commit 7613bdd1 parent 56823f82 files · +17 −5Browse files

Showing the changes to scripts/system/controllers/controllerModules (2 of 2 files). Show all

Unified · Split

2 files
  1. scripts/system/controllers/controllerModules/hudOverlayPointer.js +16 −4
  2. scripts/system/controllers/controllerModules/tabletStylusInput.js +1 −1
scripts/system/controllers/controllerModules/hudOverlayPointer.js+16−4
@@ -26,6 +26,7 @@ · 25 unmodified lines
26 var HUD_LASER_OFFSET = 2;26 var HUD_LASER_OFFSET = 2;
27 function HudOverlayPointer(hand) {27 function HudOverlayPointer(hand) {
28 this.hand = hand;28 this.hand = hand;
29 this.running = false;
29 this.reticleMinX = MARGIN;30 this.reticleMinX = MARGIN;
30 this.reticleMaxX;31 this.reticleMaxX;
31 this.reticleMinY = MARGIN;32 this.reticleMinY = MARGIN;
@@ -64,8 +65,13 @@ · 32 unmodified lines
64 return (rayPick.objectID === HMD.tabletScreenID || rayPick.objectID === HMD.homeButtonID);65 return (rayPick.objectID === HMD.tabletScreenID || rayPick.objectID === HMD.homeButtonID);
65 };66 };
66 67
68 this.getOtherModule = function() {
69 return this.hand === RIGHT_HAND ? leftHudOverlayPointer : rightHudOverlayPointer;
70 };
71
67 this.processLaser = function(controllerData) {72 this.processLaser = function(controllerData) {
68 var controllerLocation = controllerData.controllerLocations[this.hand];73 var controllerLocation = controllerData.controllerLocations[this.hand];
74 var otherModuleRunning = this.getOtherModule().running;
69 if ((controllerData.triggerValues[this.hand] < ControllerDispatcherUtils.TRIGGER_ON_VALUE || !controllerLocation.valid) ||75 if ((controllerData.triggerValues[this.hand] < ControllerDispatcherUtils.TRIGGER_ON_VALUE || !controllerLocation.valid) ||
70 this.pointingAtTablet(controllerData)) {76 this.pointingAtTablet(controllerData)) {
71 return false;77 return false;
@@ -81,11 +87,17 @@ · 9 unmodified lines
81 };87 };
82 88
83 this.isReady = function (controllerData) {89 this.isReady = function (controllerData) {
84 if (this.processLaser(controllerData)) {90 var otherModuleRunning = this.getOtherModule().running;
85 return ControllerDispatcherUtils.makeRunningValues(true, [], []);91 if (!otherModuleRunning) {
86 } else {92 if (this.processLaser(controllerData)) {
87 return ControllerDispatcherUtils.makeRunningValues(false, [], []);93 this.running = true;
94 return ControllerDispatcherUtils.makeRunningValues(true, [], []);
95 } else {
96 this.running = false;
97 return ControllerDispatcherUtils.makeRunningValues(false, [], []);
98 }
88 }99 }
100 return ControllerDispatcherUtils.makeRunningValues(false, [], []);
89 };101 };
90 102
91 this.run = function (controllerData, deltaTime) {103 this.run = function (controllerData, deltaTime) {
scripts/system/controllers/controllerModules/tabletStylusInput.js+1−1
@@ -20,7 +20,7 @@ Script.include("/~/system/libraries/controllers.js"); · 19 unmodified lines
20 var stylusTargetIDs = [];20 var stylusTargetIDs = [];
21 for (var index = 0; index < stylusTargets.length; index++) {21 for (var index = 0; index < stylusTargets.length; index++) {
22 var stylusTarget = stylusTargets[index];22 var stylusTarget = stylusTargets[index];
23 if (stylusTarget.distance <= maxNormalDistance) {23 if (stylusTarget.distance <= maxNormalDistance && stylusTarget.id !== HMD.tabletID) {
24 stylusTargetIDs.push(stylusTarget.id);24 stylusTargetIDs.push(stylusTarget.id);
25 }25 }
26 }26 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t