eslint controller modules

This commit is contained in:
Dante Ruiz 2017-11-01 11:36:36 -07:00
parent abb6f786fa
commit 66f07cb21b
15 changed files with 36 additions and 41 deletions

View file

@ -10,7 +10,8 @@
/* global Script, Entities, Overlays, Controller, Vec3, Quat, getControllerWorldLocation, RayPick,
controllerDispatcherPlugins:true, controllerDispatcherPluginsNeedSort:true,
LEFT_HAND, RIGHT_HAND, NEAR_GRAB_PICK_RADIUS, DEFAULT_SEARCH_SPHERE_DISTANCE, DISPATCHER_PROPERTIES,
getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities
getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities, Pointers, PickType, COLORS_GRAB_SEARCHING_HALF_SQUEEZE
COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, Picks
*/
controllerDispatcherPlugins = {};
@ -157,7 +158,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
var handLaser = plugin.parameters.handLaser;
if (handLaser !== undefined) {
_this.laserVisibleStatus[handLaser] = false;
_this.laserLockStatus[handLaser] = false;
_this.laserLockStatus[handLaser] = false;
}
};
@ -258,16 +259,16 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
// update left hand laser
var HUD_LASER_OFFSET = 2;
var laserLocked;
if (_this.laserVisibleStatus[LEFT_HAND]) {
var laserLocked = _this.laserLockStatus[LEFT_HAND];
laserLocked = _this.laserLockStatus[LEFT_HAND];
_this.updateLaserRenderState(_this.leftControllerPointer,_this.leftTriggerClicked, laserLocked);
} else {
Pointers.setRenderState(_this.leftControllerPointer, "");
}
//update right hand laser
if (_this.laserVisibleStatus[RIGHT_HAND]) {
var laserLocked = _this.laserLockStatus[RIGHT_HAND];
laserLocked = _this.laserLockStatus[RIGHT_HAND];
_this.updateLaserRenderState(_this.rightControllerPointer, _this.rightTriggerClicked, laserLocked);
} else {
Pointers.setRenderState(_this.rightControllerPointer, "");
@ -636,8 +637,6 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
}
function mouseReleaseOnOverlay(overlayID, event) {
if (overlayID === HMD.homeButtonID) {
print(JSON.stringify(event));
print("---------> go home <--------");
Messages.sendLocalMessage("home", overlayID);
}
}

View file

@ -73,13 +73,13 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
}
}
}
};
}
Messages.subscribe('Hifi-Hand-Disabler');
function cleanup() {
disableDispatcherModule("LeftDisableModules");
disableDispatcherModule("RightDisableModules");
};
}
Messages.messageReceived.connect(handleMessage);
Script.scriptEnding.connect(cleanup);
}());

View file

@ -773,6 +773,6 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
disableDispatcherModule("LeftEquipEntity");
disableDispatcherModule("RightEquipEntity");
clearAttachPoints();
};
}
Script.scriptEnding.connect(cleanup);
}());

View file

@ -14,14 +14,13 @@
PICK_MAX_DISTANCE, COLORS_GRAB_SEARCHING_HALF_SQUEEZE, COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD,
DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_OFF_VALUE, TRIGGER_ON_VALUE, ZERO_VEC, ensureDynamic,
getControllerWorldLocation, projectOntoEntityXYPlane, ContextOverlay, HMD, Reticle, Overlays, isPointingAtUI
Picks, makeLaserLockInfo
*/
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
Script.include("/~/system/libraries/controllers.js");
(function() {
var PICK_WITH_HAND_RAY = true;
var GRABBABLE_PROPERTIES = [
"position",
"registrationPoint",
@ -249,7 +248,7 @@ Script.include("/~/system/libraries/controllers.js");
this.grabbedThingID = null;
};
this.updateRecommendedArea = function() {
this.updateRecommendedArea = function() {
var dims = Controller.getViewportDimensions();
this.reticleMaxX = dims.x - MARGIN;
this.reticleMaxY = dims.y - MARGIN;
@ -480,6 +479,6 @@ Script.include("/~/system/libraries/controllers.js");
rightFarActionGrabEntity.cleanup();
disableDispatcherModule("LeftFarActionGrabEntity");
disableDispatcherModule("RightFarActionGrabEntity");
};
}
Script.scriptEnding.connect(cleanup);
}());

View file

@ -99,6 +99,6 @@ Script.include("/~/system/libraries/controllers.js");
function cleanup() {
disableDispatcherModule("LeftFarTriggerEntity");
disableDispatcherModule("RightFarTriggerEntity");
};
}
Script.scriptEnding.connect(cleanup);
}());

View file

@ -10,7 +10,7 @@
/* global Script, Controller, RIGHT_HAND, LEFT_HAND, enableDispatcherModule, disableDispatcherModule, makeRunningValues,
Messages, makeDispatcherModuleParameters, HMD, getGrabPointSphereOffset, COLORS_GRAB_SEARCHING_HALF_SQUEEZE,
COLORS_GRAB_SEARCHING_FULL_SQUEEZE, COLORS_GRAB_DISTANCE_HOLD, DEFAULT_SEARCH_SPHERE_DISTANCE, TRIGGER_ON_VALUE,
getEnabledModuleByName, PICK_MAX_DISTANCE, isInEditMode, LaserPointers, RayPick
getEnabledModuleByName, PICK_MAX_DISTANCE, isInEditMode, LaserPointers, RayPick, Picks
*/
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
@ -128,7 +128,7 @@ Script.include("/~/system/libraries/utils.js");
rightHandInEditMode.cleanup();
disableDispatcherModule("LeftHandInEditMode");
disableDispatcherModule("RightHandInEditMode");
};
}
Script.scriptEnding.connect(cleanup);
}());

View file

@ -261,6 +261,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
rightNearActionGrabEntity.cleanup();
disableDispatcherModule("LeftNearActionGrabEntity");
disableDispatcherModule("RightNearActionGrabEntity");
};
}
Script.scriptEnding.connect(cleanup);
}());

View file

@ -343,6 +343,6 @@ Script.include("/~/system/libraries/cloneEntityUtils.js");
rightNearParentingGrabEntity.cleanup();
disableDispatcherModule("LeftNearParentingGrabEntity");
disableDispatcherModule("RightNearParentingGrabEntity");
};
}
Script.scriptEnding.connect(cleanup);
}());

View file

@ -229,6 +229,6 @@ Script.include("/~/system/libraries/utils.js");
rightNearParentingGrabOverlay.cleanup();
disableDispatcherModule("LeftNearParentingGrabOverlay");
disableDispatcherModule("RightNearParentingGrabOverlay");
};
}
Script.scriptEnding.connect(cleanup);
}());

View file

@ -115,6 +115,6 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
rightNearTriggerEntity.cleanup();
disableDispatcherModule("LeftNearTriggerEntity");
disableDispatcherModule("RightNearTriggerEntity");
};
}
Script.scriptEnding.connect(cleanup);
}());

View file

@ -95,6 +95,6 @@ Script.include("/~/system/libraries/controllers.js");
function cleanup() {
disableDispatcherModule("LeftOverlayLaserInput");
disableDispatcherModule("RightOverlayLaserInput");
};
}
Script.scriptEnding.connect(cleanup);
}());

View file

@ -8,7 +8,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global Script, Vec3, MyAvatar, RIGHT_HAND */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function () {
var dispatcherUtils = Script.require("/~/system/libraries/controllerDispatcherUtils.js");
@ -59,7 +58,7 @@
if (this.hand === dispatcherUtils.RIGHT_HAND) {
var scalingCurrentDistance =
Vec3.length(Vec3.subtract(controllerData.controllerLocations[this.hand].position,
controllerData.controllerLocations[this.otherHand()].position));
controllerData.controllerLocations[this.otherHand()].position));
var newAvatarScale = (scalingCurrentDistance / this.scalingStartDistance) * this.scalingStartAvatarScale;
MyAvatar.scale = newAvatarScale;
@ -79,6 +78,6 @@
function cleanup() {
dispatcherUtils.disableDispatcherModule("LeftScaleAvatar");
dispatcherUtils.disableDispatcherModule("RightScaleAvatar");
};
}
Script.scriptEnding.connect(cleanup);
})();

View file

@ -8,11 +8,9 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
/* global Script, Vec3, MyAvatar, RIGHT_HAND */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function() {
var dispatcherUtils = Script.require("/~/system/libraries/controllerDispatcherUtils.js");
function ScaleEntity(hand) {
this.hand = hand;
this.grabbedThingID = false;
@ -81,7 +79,7 @@
if (this.hand === dispatcherUtils.RIGHT_HAND) {
var scalingCurrentDistance =
Vec3.length(Vec3.subtract(controllerData.controllerLocations[this.hand].position,
controllerData.controllerLocations[this.otherHand()].position));
controllerData.controllerLocations[this.otherHand()].position));
var currentRescale = scalingCurrentDistance / this.scalingStartDistance;
var newDimensions = Vec3.multiply(currentRescale, this.scalingStartDimensions);
Entities.editEntity(this.grabbedThingID, { dimensions: newDimensions });
@ -101,6 +99,6 @@
function cleanup() {
dispatcherUtils.disableDispatcherModule("LeftScaleEntity");
dispatcherUtils.disableDispatcherModule("RightScaleEntity");
};
}
Script.scriptEnding.connect(cleanup);
})();

View file

@ -12,7 +12,7 @@
/* global Script, Entities, MyAvatar, Controller, RIGHT_HAND, LEFT_HAND, getControllerJointIndex,
enableDispatcherModule, disableDispatcherModule, Messages, makeDispatcherModuleParameters, makeRunningValues, Vec3,
LaserPointers, RayPick, HMD, Uuid, AvatarList
LaserPointers, RayPick, HMD, Uuid, AvatarList, Picks
*/
Script.include("/~/system/libraries/Xform.js");
@ -109,8 +109,8 @@ Script.include("/~/system/libraries/controllers.js");
var teleportRenderStates = [{name: "cancel", path: cancelPath, end: cancelEnd},
{name: "teleport", path: teleportPath, end: teleportEnd},
{name: "seat", path: seatPath, end: seatEnd}];
{name: "teleport", path: teleportPath, end: teleportEnd},
{name: "seat", path: seatPath, end: seatEnd}];
var DEFAULT_DISTANCE = 50;
var teleportDefaultRenderStates = [{name: "cancel", distance: DEFAULT_DISTANCE, path: cancelPath}];
@ -127,18 +127,18 @@ Script.include("/~/system/libraries/controllers.js");
};
var TARGET = {
NONE: 'none', // Not currently targetting anything
INVISIBLE: 'invisible', // The current target is an invvsible surface
INVALID: 'invalid', // The current target is invalid (wall, ceiling, etc.)
SURFACE: 'surface', // The current target is a valid surface
SEAT: 'seat' // The current target is a seat
NONE: 'none', // Not currently targetting anything
INVISIBLE: 'invisible', // The current target is an invvsible surface
INVALID: 'invalid', // The current target is invalid (wall, ceiling, etc.)
SURFACE: 'surface', // The current target is a valid surface
SEAT: 'seat' // The current target is a seat
};
function Teleporter(hand) {
var _this = this;
this.hand = hand;
this.buttonValue = 0;
this.disabled = false; // used by the 'Hifi-Teleport-Disabler' message handler
this.disabled = false; // used by the 'Hifi-Teleport-Disabler' message handler
this.active = false;
this.state = TELEPORTER_STATES.IDLE;
this.currentTarget = TARGET.INVALID;
@ -218,8 +218,8 @@ Script.include("/~/system/libraries/controllers.js");
seatEnd.dimensions = AVATAR_PROPORTIONAL_TARGET_MODEL_DIMENSIONS;
teleportRenderStates = [{name: "cancel", path: cancelPath, end: cancelEnd},
{name: "teleport", path: teleportPath, end: teleportEnd},
{name: "seat", path: seatPath, end: seatEnd}];
{name: "teleport", path: teleportPath, end: teleportEnd},
{name: "seat", path: seatPath, end: seatEnd}];
LaserPointers.editRenderState(this.teleportRayHandVisible, "cancel", teleportRenderStates[0]);
LaserPointers.editRenderState(this.teleportRayHandInvisible, "cancel", teleportRenderStates[0]);

View file

@ -60,7 +60,7 @@ Script.include("/~/system/libraries/controllers.js");
function cleanup() {
disableDispatcherModule("LeftWebEntityLaserInput");
disableDispatcherModule("RightWebEntityLaserInput");
};
}
Script.scriptEnding.connect(cleanup);
}());