From abb6f786fab6918b76774cf0fd63844603ca8e21 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 1 Nov 2017 11:03:48 -0700 Subject: [PATCH] added homebutton message and scripts cleanup --- scripts/system/controllers/controllerDispatcher.js | 11 +++++++++-- .../controllerModules/disableOtherModule.js | 8 ++++---- .../controllerModules/farActionGrabEntity.js | 4 ++-- .../controllerModules/nearActionGrabEntity.js | 4 ++-- .../controllerModules/nearParentGrabEntity.js | 4 ++-- .../controllerModules/nearParentGrabOverlay.js | 4 ++-- .../controllers/controllerModules/nearTrigger.js | 4 ++-- .../controllers/controllerModules/scaleEntity.js | 4 ++-- 8 files changed, 25 insertions(+), 18 deletions(-) diff --git a/scripts/system/controllers/controllerDispatcher.js b/scripts/system/controllers/controllerDispatcher.js index 6f68edad07..915d683724 100644 --- a/scripts/system/controllers/controllerDispatcher.js +++ b/scripts/system/controllers/controllerDispatcher.js @@ -168,7 +168,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); var pointer = (hand === RIGHT_HAND) ? _this.rightControllerPointer : _this.leftControllerPointer; var targetID = laserLockInfo.targetID; var targetIsOverlay = laserLockInfo.isOverlay; - Pointers.setLockEndUUID(pointer, targetID, targetIsOverlay); + Pointers.setLockEndUid(pointer, targetID, targetIsOverlay); _this.laserLockStatus[hand] = targetID; } } else { @@ -634,7 +634,14 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); Pointers.removePointer(_this.leftControllerHudRayPick); }; } - + function mouseReleaseOnOverlay(overlayID, event) { + if (overlayID === HMD.homeButtonID) { + print(JSON.stringify(event)); + print("---------> go home <--------"); + Messages.sendLocalMessage("home", overlayID); + } + } + Overlays.mouseReleaseOnOverlay.connect(mouseReleaseOnOverlay); var controllerDispatcher = new ControllerDispatcher(); Messages.subscribe('Hifi-Hand-RayPick-Blacklist'); Messages.messageReceived.connect(controllerDispatcher.handleHandMessage); diff --git a/scripts/system/controllers/controllerModules/disableOtherModule.js b/scripts/system/controllers/controllerModules/disableOtherModule.js index 92784ec2ed..e873579ba7 100644 --- a/scripts/system/controllers/controllerModules/disableOtherModule.js +++ b/scripts/system/controllers/controllerModules/disableOtherModule.js @@ -53,7 +53,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); enableDispatcherModule("LeftDisableModules", leftDisableModules); enableDispatcherModule("RightDisableModules", rightDisableModules); - this.handleMessage = function(channel, message, sender) { + function handleMessage(channel, message, sender) { if (sender === MyAvatar.sessionUUID) { if (channel === 'Hifi-Hand-Disabler') { if (message === 'left') { @@ -76,10 +76,10 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); }; Messages.subscribe('Hifi-Hand-Disabler'); - this.cleanup = function() { + function cleanup() { disableDispatcherModule("LeftDisableModules"); disableDispatcherModule("RightDisableModules"); }; - Messages.messageReceived.connect(this.handleMessage); - Script.scriptEnding.connect(this.cleanup); + Messages.messageReceived.connect(handleMessage); + Script.scriptEnding.connect(cleanup); }()); diff --git a/scripts/system/controllers/controllerModules/farActionGrabEntity.js b/scripts/system/controllers/controllerModules/farActionGrabEntity.js index 6f818b8b1e..e0f8834e38 100644 --- a/scripts/system/controllers/controllerModules/farActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/farActionGrabEntity.js @@ -475,11 +475,11 @@ Script.include("/~/system/libraries/controllers.js"); enableDispatcherModule("LeftFarActionGrabEntity", leftFarActionGrabEntity); enableDispatcherModule("RightFarActionGrabEntity", rightFarActionGrabEntity); - this.cleanup = function () { + function cleanup() { leftFarActionGrabEntity.cleanup(); rightFarActionGrabEntity.cleanup(); disableDispatcherModule("LeftFarActionGrabEntity"); disableDispatcherModule("RightFarActionGrabEntity"); }; - Script.scriptEnding.connect(this.cleanup); + Script.scriptEnding.connect(cleanup); }()); diff --git a/scripts/system/controllers/controllerModules/nearActionGrabEntity.js b/scripts/system/controllers/controllerModules/nearActionGrabEntity.js index 6b2a986f0f..4fc192cc6b 100644 --- a/scripts/system/controllers/controllerModules/nearActionGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearActionGrabEntity.js @@ -256,11 +256,11 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); enableDispatcherModule("LeftNearActionGrabEntity", leftNearActionGrabEntity); enableDispatcherModule("RightNearActionGrabEntity", rightNearActionGrabEntity); - this.cleanup = function () { + function cleanup() { leftNearActionGrabEntity.cleanup(); rightNearActionGrabEntity.cleanup(); disableDispatcherModule("LeftNearActionGrabEntity"); disableDispatcherModule("RightNearActionGrabEntity"); }; - Script.scriptEnding.connect(this.cleanup); + Script.scriptEnding.connect(cleanup); }()); diff --git a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js index 178d459b1d..1a5e82599d 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabEntity.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabEntity.js @@ -338,11 +338,11 @@ Script.include("/~/system/libraries/cloneEntityUtils.js"); enableDispatcherModule("LeftNearParentingGrabEntity", leftNearParentingGrabEntity); enableDispatcherModule("RightNearParentingGrabEntity", rightNearParentingGrabEntity); - this.cleanup = function () { + function cleanup() { leftNearParentingGrabEntity.cleanup(); rightNearParentingGrabEntity.cleanup(); disableDispatcherModule("LeftNearParentingGrabEntity"); disableDispatcherModule("RightNearParentingGrabEntity"); }; - Script.scriptEnding.connect(this.cleanup); + Script.scriptEnding.connect(cleanup); }()); diff --git a/scripts/system/controllers/controllerModules/nearParentGrabOverlay.js b/scripts/system/controllers/controllerModules/nearParentGrabOverlay.js index 925c50df5e..5333196bd0 100644 --- a/scripts/system/controllers/controllerModules/nearParentGrabOverlay.js +++ b/scripts/system/controllers/controllerModules/nearParentGrabOverlay.js @@ -224,11 +224,11 @@ Script.include("/~/system/libraries/utils.js"); enableDispatcherModule("LeftNearParentingGrabOverlay", leftNearParentingGrabOverlay); enableDispatcherModule("RightNearParentingGrabOverlay", rightNearParentingGrabOverlay); - this.cleanup = function () { + function cleanup() { leftNearParentingGrabOverlay.cleanup(); rightNearParentingGrabOverlay.cleanup(); disableDispatcherModule("LeftNearParentingGrabOverlay"); disableDispatcherModule("RightNearParentingGrabOverlay"); }; - Script.scriptEnding.connect(this.cleanup); + Script.scriptEnding.connect(cleanup); }()); diff --git a/scripts/system/controllers/controllerModules/nearTrigger.js b/scripts/system/controllers/controllerModules/nearTrigger.js index 56a4e93495..a8aa72f1aa 100644 --- a/scripts/system/controllers/controllerModules/nearTrigger.js +++ b/scripts/system/controllers/controllerModules/nearTrigger.js @@ -110,11 +110,11 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js"); enableDispatcherModule("LeftNearTriggerEntity", leftNearTriggerEntity); enableDispatcherModule("RightNearTriggerEntity", rightNearTriggerEntity); - this.cleanup = function () { + function cleanup() { leftNearTriggerEntity.cleanup(); rightNearTriggerEntity.cleanup(); disableDispatcherModule("LeftNearTriggerEntity"); disableDispatcherModule("RightNearTriggerEntity"); }; - Script.scriptEnding.connect(this.cleanup); + Script.scriptEnding.connect(cleanup); }()); diff --git a/scripts/system/controllers/controllerModules/scaleEntity.js b/scripts/system/controllers/controllerModules/scaleEntity.js index 79b1d18db9..d45a4a5071 100644 --- a/scripts/system/controllers/controllerModules/scaleEntity.js +++ b/scripts/system/controllers/controllerModules/scaleEntity.js @@ -98,9 +98,9 @@ dispatcherUtils.enableDispatcherModule("LeftScaleEntity", leftScaleEntity); dispatcherUtils.enableDispatcherModule("RightScaleEntity", rightScaleEntity); - this.cleanup = function() { + function cleanup() { dispatcherUtils.disableDispatcherModule("LeftScaleEntity"); dispatcherUtils.disableDispatcherModule("RightScaleEntity"); }; - Script.scriptEnding.connect(this.cleanup); + Script.scriptEnding.connect(cleanup); })();