From ecf382605014953caced6251cc7cd5c576a2fcd5 Mon Sep 17 00:00:00 2001 From: Andrew Lowry Date: Sat, 22 Apr 2017 18:42:13 -0400 Subject: [PATCH] Always show hand lasers when in edit mode. --- .../system/controllers/handControllerGrab.js | 28 +++++++++++++++++-- scripts/system/edit.js | 3 +- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 8fc7b8af4c..70378978d3 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1330,7 +1330,7 @@ function MyController(hand) { if (this.stylus) { return; } - + var stylusProperties = { name: "stylus", url: Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx", @@ -1420,6 +1420,14 @@ function MyController(hand) { } }; + // Turns off indicators used for searching. Overlay line and sphere. + this.searchIndicatorOff = function() { + this.searchSphereOff(); + if (PICK_WITH_HAND_RAY) { + this.overlayLineOff(); + } + } + this.otherGrabbingLineOn = function(avatarPosition, entityPosition, color) { if (this.otherGrabbingLine === null) { var lineProperties = { @@ -1791,6 +1799,15 @@ function MyController(hand) { } this.processStylus(); + + if (isInEditMode() && !this.isNearStylusTarget) { + // Always showing lasers while in edit mode and hands/stylus is not active. + var rayPickInfo = this.calcRayPickInfo(this.hand); + this.intersectionDistance = (rayPickInfo.entityID || rayPickInfo.overlayID) ? rayPickInfo.distance : 0; + this.searchIndicatorOn(rayPickInfo.searchRay); + } else { + this.searchIndicatorOff(); + } }; this.handleLaserOnHomeButton = function(rayPickInfo) { @@ -2281,7 +2298,7 @@ function MyController(hand) { if (this.getOtherHandController().state === STATE_DISTANCE_HOLDING) { this.setState(STATE_DISTANCE_ROTATING, "distance rotate '" + name + "'"); } else { - this.setState(STATE_DISTANCE_HOLDING, "distance hold '" + name + "'"); + this.setState(STATE_DISTANCE_HOLDING, "distance hold '" + name + "'"); } return; } else { @@ -3346,7 +3363,14 @@ function MyController(hand) { }; this.offEnter = function() { + // Reuse the existing search distance if lasers were active since + // they will be shown in OFF state while in edit mode. + var existingSearchDistance = this.searchSphereDistance; this.release(); + + if (isInEditMode()) { + this.searchSphereDistance = existingSearchDistance; + } }; this.entityLaserTouchingEnter = function() { diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 058aae9905..0082100148 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -12,7 +12,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -/* global Script, SelectionDisplay, LightOverlayManager, CameraManager, Grid, GridTool, EntityListTool, Vec3, SelectionManager, Overlays, OverlayWebWindow, UserActivityLogger, Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera, progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool */ +/* global Script, SelectionDisplay, LightOverlayManager, CameraManager, Grid, GridTool, EntityListTool, Vec3, SelectionManager, Overlays, OverlayWebWindow, UserActivityLogger, + Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera, progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool */ (function() { // BEGIN LOCAL_SCOPE