From fefe5e30ec4b3e431c7a61f299594562266e20ec Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Tue, 23 Aug 2016 12:54:09 -0700 Subject: [PATCH] don't use globals and remove double definitions --- scripts/system/controllers/grab.js | 21 ++++----------------- scripts/system/progress.js | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/scripts/system/controllers/grab.js b/scripts/system/controllers/grab.js index dc57fe4451..05303aa0a7 100644 --- a/scripts/system/controllers/grab.js +++ b/scripts/system/controllers/grab.js @@ -15,8 +15,7 @@ (function() { // BEGIN LOCAL_SCOPE Script.include("../libraries/utils.js"); -// objects that appear smaller than this can't be grabbed -var MAX_SOLID_ANGLE = 0.01; +var MAX_SOLID_ANGLE = 0.01; // objects that appear smaller than this can't be grabbed var ZERO_VEC3 = { x: 0, @@ -42,18 +41,6 @@ var DEFAULT_GRABBABLE_DATA = { }; -var MAX_SOLID_ANGLE = 0.01; // objects that appear smaller than this can't be grabbed -var ZERO_VEC3 = { - x: 0, - y: 0, - z: 0 -}; -var IDENTITY_QUAT = { - x: 0, - y: 0, - z: 0, - w: 0 -}; var ACTION_TTL = 10; // seconds var enabled = true; @@ -124,7 +111,7 @@ function mouseIntersectionWithPlane(pointOnPlane, planeNormal, event, maxDistanc } // Mouse class stores mouse click and drag info -Mouse = function() { +function Mouse() { this.current = { x: 0, y: 0 @@ -194,7 +181,7 @@ var mouse = new Mouse(); // Beacon class stores info for drawing a line at object's target position -Beacon = function() { +function Beacon() { this.height = 0.10; this.overlayID = Overlays.addOverlay("line3d", { color: { @@ -246,7 +233,7 @@ var beacon = new Beacon(); // Grabber class stores and computes info for grab behavior -Grabber = function() { +function Grabber() { this.isGrabbing = false; this.entityID = null; this.actionID = null; diff --git a/scripts/system/progress.js b/scripts/system/progress.js index 2b1efa94af..d7f6713c69 100644 --- a/scripts/system/progress.js +++ b/scripts/system/progress.js @@ -245,7 +245,7 @@ } function updateProgressBarLocation() { - viewport = Controller.getViewportDimensions(); + var viewport = Controller.getViewportDimensions(); windowWidth = viewport.x; windowHeight = viewport.y;