From ed4d0f2577107e4282926156ef5a5453dff6fbc4 Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 3 Jul 2018 12:39:41 -0700 Subject: [PATCH 1/4] early-out if event undefined --- .../system/libraries/entitySelectionTool.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index cd3c9fe418..9dee29ba78 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -1654,6 +1654,10 @@ SelectionDisplay = (function() { return (origin.y - intersection.y) / Vec3.distance(origin, intersection); }, onMove: function(event) { + if (event.x === undefined || event.y === undefined) { + return; + } + var wantDebug = false; var pickRay = generalComputePickRay(event.x, event.y); @@ -1811,6 +1815,10 @@ SelectionDisplay = (function() { pushCommandForSelections(duplicatedEntityIDs); }, onMove: function(event) { + if (event.x === undefined || event.y === undefined) { + return; + } + var pickRay = generalComputePickRay(event.x, event.y); // Use previousPickRay if new pickRay will cause resulting rayPlaneIntersection values to wrap around @@ -2060,7 +2068,11 @@ SelectionDisplay = (function() { pushCommandForSelections(); }; - var onMove = function(event) { + var onMove = function(event) + if (event.x === undefined || event.y === undefined) { + return; + } + var proportional = (spaceMode === SPACE_WORLD) || directionEnum === STRETCH_DIRECTION.ALL; var position, rotation; @@ -2393,6 +2405,10 @@ SelectionDisplay = (function() { // EARLY EXIT return; } + + if (event.x === undefined || event.y === undefined) { + return; + } var wantDebug = false; if (wantDebug) { From 2af0f05cb4b09d3c530d7c323d93f9e5ccc62ec0 Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 3 Jul 2018 12:40:19 -0700 Subject: [PATCH 2/4] tabs --- .../system/libraries/entitySelectionTool.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 9dee29ba78..273ecb6fe5 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -1654,10 +1654,10 @@ SelectionDisplay = (function() { return (origin.y - intersection.y) / Vec3.distance(origin, intersection); }, onMove: function(event) { - if (event.x === undefined || event.y === undefined) { - return; - } - + if (event.x === undefined || event.y === undefined) { + return; + } + var wantDebug = false; var pickRay = generalComputePickRay(event.x, event.y); @@ -1815,9 +1815,9 @@ SelectionDisplay = (function() { pushCommandForSelections(duplicatedEntityIDs); }, onMove: function(event) { - if (event.x === undefined || event.y === undefined) { - return; - } + if (event.x === undefined || event.y === undefined) { + return; + } var pickRay = generalComputePickRay(event.x, event.y); @@ -2069,10 +2069,10 @@ SelectionDisplay = (function() { }; var onMove = function(event) - if (event.x === undefined || event.y === undefined) { - return; - } - + if (event.x === undefined || event.y === undefined) { + return; + } + var proportional = (spaceMode === SPACE_WORLD) || directionEnum === STRETCH_DIRECTION.ALL; var position, rotation; @@ -2405,10 +2405,10 @@ SelectionDisplay = (function() { // EARLY EXIT return; } - - if (event.x === undefined || event.y === undefined) { - return; - } + + if (event.x === undefined || event.y === undefined) { + return; + } var wantDebug = false; if (wantDebug) { From afbe64ec11d15a4366b0aa52f9d62fe57515f8ca Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 3 Jul 2018 13:32:11 -0700 Subject: [PATCH 3/4] missing bracket --- scripts/system/libraries/entitySelectionTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 273ecb6fe5..a84afbe322 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -2068,7 +2068,7 @@ SelectionDisplay = (function() { pushCommandForSelections(); }; - var onMove = function(event) + var onMove = function(event) { if (event.x === undefined || event.y === undefined) { return; } From 3bcc727d4745d717b83ef3baa31a3f2d4e002f90 Mon Sep 17 00:00:00 2001 From: David Back Date: Fri, 6 Jul 2018 18:57:32 -0700 Subject: [PATCH 4/4] check controller triggered in checkControllerMove --- .../system/libraries/entitySelectionTool.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index e73f8a46b8..faa65e1947 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -969,7 +969,7 @@ SelectionDisplay = (function() { if (SelectionManager.hasSelection()) { var controllerPose = getControllerWorldLocation(activeHand, true); var hand = (activeHand === Controller.Standard.LeftHand) ? 0 : 1; - if (controllerPose.valid && lastControllerPoses[hand].valid) { + if (controllerPose.valid && lastControllerPoses[hand].valid && that.triggered) { if (!Vec3.equal(controllerPose.position, lastControllerPoses[hand].position) || !Vec3.equal(controllerPose.rotation, lastControllerPoses[hand].rotation)) { that.mouseMoveEvent({}); @@ -1656,10 +1656,6 @@ SelectionDisplay = (function() { return (origin.y - intersection.y) / Vec3.distance(origin, intersection); }, onMove: function(event) { - if (event.x === undefined || event.y === undefined) { - return; - } - var wantDebug = false; var pickRay = generalComputePickRay(event.x, event.y); @@ -1817,10 +1813,6 @@ SelectionDisplay = (function() { pushCommandForSelections(duplicatedEntityIDs); }, onMove: function(event) { - if (event.x === undefined || event.y === undefined) { - return; - } - var pickRay = generalComputePickRay(event.x, event.y); // Use previousPickRay if new pickRay will cause resulting rayPlaneIntersection values to wrap around @@ -2071,10 +2063,6 @@ SelectionDisplay = (function() { }; var onMove = function(event) { - if (event.x === undefined || event.y === undefined) { - return; - } - var proportional = directionEnum === STRETCH_DIRECTION.ALL; var position, rotation; @@ -2408,10 +2396,6 @@ SelectionDisplay = (function() { return; } - if (event.x === undefined || event.y === undefined) { - return; - } - var wantDebug = false; if (wantDebug) { print("================== "+ getMode() + "(addHandleRotateTool onMove) -> =======================");