From 801a4b9aba53695aaa6d69343859bd43eed0bd75 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 17 May 2018 15:09:23 +1200 Subject: [PATCH] Make laser click in sky deselect entity --- .../system/controllers/controllerModules/inEditMode.js | 5 +++++ scripts/system/libraries/entitySelectionTool.js | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index 3ad7902d71..5d90898b82 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -52,6 +52,11 @@ Script.include("/~/system/libraries/utils.js"); if (controllerData.triggerClicks[this.hand]) { if (!this.triggerClicked) { this.selectedTarget = controllerData.rayPicks[this.hand]; + if (!this.selectedTarget.intersects) { + Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ + method: "clearSelection" + })); + } } if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) { Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 6fa500ebfc..7430931c25 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -56,6 +56,8 @@ SelectionManager = (function() { print("setting selection to " + messageParsed.entityID); } that.setSelections([messageParsed.entityID]); + } else if (messageParsed.method === "clearSelection") { + that.clearSelections(); } } @@ -574,7 +576,7 @@ SelectionDisplay = (function() { handleScaleFREdge, handleScaleFLEdge, handleCloner, - selectionBox // Must be last overlay. + selectionBox ]; overlayNames[handleTranslateXCone] = "handleTranslateXCone"; @@ -1391,9 +1393,8 @@ SelectionDisplay = (function() { }; // FUNCTION: SET OVERLAYS VISIBLE - that.setOverlaysVisible = function (isVisible) { - // Don't set selectionBox (last) overlay's visibility. - for (var i = 0, length = allOverlays.length - 1; i < length; i++) { + that.setOverlaysVisible = function(isVisible) { + for (var i = 0, length = allOverlays.length; i < length; i++) { Overlays.editOverlay(allOverlays[i], { visible: isVisible }); } };