From 82e5d6ad29693b278c9f003d604c27e925ebab14 Mon Sep 17 00:00:00 2001 From: David Back Date: Thu, 26 Jul 2018 16:38:25 -0700 Subject: [PATCH 1/7] use triggerClicks from controllers for edit handles --- .../controllerModules/inEditMode.js | 11 +++++++++++ .../system/libraries/entitySelectionTool.js | 18 +++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index 377167d7bf..e9b83bbcbb 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -73,6 +73,9 @@ Script.include("/~/system/libraries/utils.js"); method: "clearSelection" })); } + Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ + method: "triggerClicked" + })); } if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) { if (!this.isTabletMaterialEntity(this.selectedTarget.objectID)) { @@ -89,6 +92,14 @@ Script.include("/~/system/libraries/utils.js"); } this.triggerClicked = true; + } else { + if (this.triggerClicked) { + Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ + method: "triggerUnClicked" + })); + } + + this.triggerClicked = false; } this.sendPointingAtData(controllerData); diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 091d431502..4a5eb9afca 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -14,13 +14,14 @@ // /* global SelectionManager, SelectionDisplay, grid, rayPlaneIntersection, rayPlaneIntersection2, pushCommandForSelections, - getMainTabletIDs, getControllerWorldLocation */ + getMainTabletIDs, getControllerWorldLocation, TRIGGER_ON_VALUE, TRIGGER_OFF_VALUE */ var SPACE_LOCAL = "local"; var SPACE_WORLD = "world"; var HIGHLIGHT_LIST_NAME = "editHandleHighlightList"; Script.include([ + "./controllerDispatcherUtils.js", "./controllers.js", "./utils.js" ]); @@ -67,6 +68,10 @@ SelectionManager = (function() { that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow; that.pointingAtTabletLeft = messageParsed.tablet; } + } else if (messageParsed.method === "triggerClicked") { + that.triggerClicked = true; + } else if (messageParsed.method === "triggerUnClicked") { + that.triggerClicked = false; } } @@ -109,6 +114,8 @@ SelectionManager = (function() { that.pointingAtDesktopWindowRight = false; that.pointingAtTabletLeft = false; that.pointingAtTabletRight = false; + + that.triggerClicked = false; that.saveProperties = function() { that.savedProperties = {}; @@ -751,14 +758,11 @@ SelectionDisplay = (function() { // But we dont' get mousePressEvents. that.triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click'); Script.scriptEnding.connect(that.triggerMapping.disable); - that.TRIGGER_GRAB_VALUE = 0.85; // From handControllerGrab/Pointer.js. Should refactor. - that.TRIGGER_ON_VALUE = 0.4; - that.TRIGGER_OFF_VALUE = 0.15; that.triggered = false; var activeHand = Controller.Standard.RightHand; function makeTriggerHandler(hand) { - return function (value) { - if (!that.triggered && (value > that.TRIGGER_GRAB_VALUE)) { // should we smooth? + return function () { + if (!that.triggered && SelectionManager.triggerClicked) { that.triggered = true; if (activeHand !== hand) { // No switching while the other is already triggered, so no need to release. @@ -775,7 +779,7 @@ SelectionDisplay = (function() { return; } that.mousePressEvent({}); - } else if (that.triggered && (value < that.TRIGGER_OFF_VALUE)) { + } else if (that.triggered && !SelectionManager.triggerClicked) { that.triggered = false; that.mouseReleaseEvent({}); } From dcdf734114c86aec781412317864887e7bbed0d3 Mon Sep 17 00:00:00 2001 From: David Back Date: Thu, 26 Jul 2018 16:43:07 -0700 Subject: [PATCH 2/7] remove unneeded --- scripts/system/libraries/entitySelectionTool.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 4a5eb9afca..00533b86a5 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -14,14 +14,13 @@ // /* global SelectionManager, SelectionDisplay, grid, rayPlaneIntersection, rayPlaneIntersection2, pushCommandForSelections, - getMainTabletIDs, getControllerWorldLocation, TRIGGER_ON_VALUE, TRIGGER_OFF_VALUE */ + getMainTabletIDs, getControllerWorldLocation */ var SPACE_LOCAL = "local"; var SPACE_WORLD = "world"; var HIGHLIGHT_LIST_NAME = "editHandleHighlightList"; Script.include([ - "./controllerDispatcherUtils.js", "./controllers.js", "./utils.js" ]); From cd842afc1c3d3463bd4104164f19256a13d4c335 Mon Sep 17 00:00:00 2001 From: David Back Date: Thu, 26 Jul 2018 17:52:25 -0700 Subject: [PATCH 3/7] prevent both hands triggering same time, allow one to trigger after other --- .../controllerModules/inEditMode.js | 8 +- .../system/libraries/entitySelectionTool.js | 90 ++++++++++++------- 2 files changed, 62 insertions(+), 36 deletions(-) diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index e9b83bbcbb..e6a5efc6a2 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -74,7 +74,9 @@ Script.include("/~/system/libraries/utils.js"); })); } Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ - method: "triggerClicked" + method: "triggerClicked", + clicked: true, + rightHand: this.hand === RIGHT_HAND })); } if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) { @@ -95,7 +97,9 @@ Script.include("/~/system/libraries/utils.js"); } else { if (this.triggerClicked) { Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ - method: "triggerUnClicked" + method: "triggerClicked", + clicked: false, + rightHand: this.hand === RIGHT_HAND })); } diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 00533b86a5..8b7e892870 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -68,9 +68,11 @@ SelectionManager = (function() { that.pointingAtTabletLeft = messageParsed.tablet; } } else if (messageParsed.method === "triggerClicked") { - that.triggerClicked = true; - } else if (messageParsed.method === "triggerUnClicked") { - that.triggerClicked = false; + if (messageParsed.rightHand) { + that.triggerClickedRight = messageParsed.clicked; + } else { + that.triggerClickedLeft = messageParsed.clicked; + } } } @@ -114,7 +116,8 @@ SelectionManager = (function() { that.pointingAtTabletLeft = false; that.pointingAtTabletRight = false; - that.triggerClicked = false; + that.triggerClickedRight = false; + that.triggerClickedLeft = false; that.saveProperties = function() { that.savedProperties = {}; @@ -416,6 +419,8 @@ SelectionDisplay = (function() { YAW: 1, ROLL: 2 }; + + var NO_TRIGGER_HAND = -1; var spaceMode = SPACE_LOCAL; var overlayNames = []; @@ -757,30 +762,47 @@ SelectionDisplay = (function() { // But we dont' get mousePressEvents. that.triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click'); Script.scriptEnding.connect(that.triggerMapping.disable); - that.triggered = false; - var activeHand = Controller.Standard.RightHand; + that.triggeredHand = NO_TRIGGER_HAND; + that.triggered = function() { + return that.triggeredHand !== NO_TRIGGER_HAND; + } + function triggerPress(hand) { + that.triggeredHand = hand; + var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && + SelectionManager.pointingAtDesktopWindowRight) || + (hand === Controller.Standard.LeftHand && + SelectionManager.pointingAtDesktopWindowLeft); + var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || + (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); + if (pointingAtDesktopWindow || pointingAtTablet) { + return; + } + that.mousePressEvent({}); + } + function triggerRelease(hand) { + that.triggeredHand = NO_TRIGGER_HAND; + that.mouseReleaseEvent({}); + var otherTriggerClicked = hand == Controller.Standard.RightHand ? SelectionManager.triggerClickedLeft : + SelectionManager.triggerClickedRight; + // When one hand is released check if the other hand is clicked and should then trigger a press + if (otherTriggerClicked) { + var otherHand = hand == Controller.Standard.RightHand ? Controller.Standard.LeftHand : + Controller.Standard.RightHand; + triggerPress(otherHand); + } + } function makeTriggerHandler(hand) { return function () { - if (!that.triggered && SelectionManager.triggerClicked) { - that.triggered = true; - if (activeHand !== hand) { - // No switching while the other is already triggered, so no need to release. - activeHand = (activeHand === Controller.Standard.RightHand) ? - Controller.Standard.LeftHand : Controller.Standard.RightHand; - } - var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && - SelectionManager.pointingAtDesktopWindowRight) || - (hand === Controller.Standard.LeftHand && - SelectionManager.pointingAtDesktopWindowLeft); - var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || - (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); - if (pointingAtDesktopWindow || pointingAtTablet) { - return; - } - that.mousePressEvent({}); - } else if (that.triggered && !SelectionManager.triggerClicked) { - that.triggered = false; - that.mouseReleaseEvent({}); + // Don't allow both hands to trigger at the same time + if (that.triggered() && hand !== that.triggeredHand) { + return; + } + var triggerClicked = hand == Controller.Standard.RightHand ? SelectionManager.triggerClickedRight : + SelectionManager.triggerClickedLeft; + if (!that.triggered() && triggerClicked) { + triggerPress(hand); + } else if (that.triggered() && !triggerClicked) { + triggerRelease(hand); } }; } @@ -836,7 +858,7 @@ SelectionDisplay = (function() { if (wantDebug) { print("=============== eST::MousePressEvent BEG ======================="); } - if (!event.isLeftButton && !that.triggered) { + if (!event.isLeftButton && !that.triggered()) { // EARLY EXIT-(if another mouse button than left is pressed ignore it) return false; } @@ -1082,9 +1104,9 @@ SelectionDisplay = (function() { that.checkControllerMove = function() { if (SelectionManager.hasSelection()) { - var controllerPose = getControllerWorldLocation(activeHand, true); - var hand = (activeHand === Controller.Standard.LeftHand) ? 0 : 1; - if (controllerPose.valid && lastControllerPoses[hand].valid && that.triggered) { + var controllerPose = getControllerWorldLocation(that.triggeredHand, true); + var hand = (that.triggeredHand === Controller.Standard.LeftHand) ? 0 : 1; + 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({}); @@ -1095,8 +1117,8 @@ SelectionDisplay = (function() { }; function controllerComputePickRay() { - var controllerPose = getControllerWorldLocation(activeHand, true); - if (controllerPose.valid && that.triggered) { + var controllerPose = getControllerWorldLocation(that.triggeredHand, true); + if (controllerPose.valid && that.triggered()) { var controllerPosition = controllerPose.translation; // This gets point direction right, but if you want general quaternion it would be more complicated: var controllerDirection = Quat.getUp(controllerPose.rotation); @@ -2246,11 +2268,11 @@ SelectionDisplay = (function() { } // Are we using handControllers or Mouse - only relevant for 3D tools - var controllerPose = getControllerWorldLocation(activeHand, true); + var controllerPose = getControllerWorldLocation(that.triggeredHand, true); var vector = null; var newPick = null; if (HMD.isHMDAvailable() && HMD.isHandControllerAvailable() && - controllerPose.valid && that.triggered && directionFor3DStretch) { + controllerPose.valid && that.triggered() && directionFor3DStretch) { localDeltaPivot = deltaPivot3D; newPick = pickRay.origin; vector = Vec3.subtract(newPick, lastPick3D); From b420ef8cf2a1b86d6d2af3310ee6e99a1d71cd18 Mon Sep 17 00:00:00 2001 From: David Back Date: Mon, 30 Jul 2018 13:21:09 -0700 Subject: [PATCH 4/7] fix trigger clicks on vive --- .../system/libraries/entitySelectionTool.js | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 8b7e892870..96dc9d676b 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -761,13 +761,13 @@ SelectionDisplay = (function() { // We get mouseMoveEvents from the handControllers, via handControllerPointer. // But we dont' get mousePressEvents. that.triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click'); + that.triggerPressMapping = Controller.newMapping(Script.resolvePath('') + '-press'); Script.scriptEnding.connect(that.triggerMapping.disable); that.triggeredHand = NO_TRIGGER_HAND; that.triggered = function() { return that.triggeredHand !== NO_TRIGGER_HAND; } function triggerPress(hand) { - that.triggeredHand = hand; var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtDesktopWindowRight) || (hand === Controller.Standard.LeftHand && @@ -777,6 +777,7 @@ SelectionDisplay = (function() { if (pointingAtDesktopWindow || pointingAtTablet) { return; } + that.triggeredHand = hand; that.mousePressEvent({}); } function triggerRelease(hand) { @@ -791,23 +792,33 @@ SelectionDisplay = (function() { triggerPress(otherHand); } } - function makeTriggerHandler(hand) { - return function () { - // Don't allow both hands to trigger at the same time - if (that.triggered() && hand !== that.triggeredHand) { - return; - } + function handleTriggerPress(hand, triggerClicked) { + // Don't allow both hands to trigger at the same time + if (that.triggered() && hand !== that.triggeredHand) { + return; + } + if (!that.triggered() && triggerClicked) { + triggerPress(hand); + } else if (that.triggered() && !triggerClicked) { + triggerRelease(hand); + } + } + function makePressHandler(hand) { + return function (value) { var triggerClicked = hand == Controller.Standard.RightHand ? SelectionManager.triggerClickedRight : SelectionManager.triggerClickedLeft; - if (!that.triggered() && triggerClicked) { - triggerPress(hand); - } else if (that.triggered() && !triggerClicked) { - triggerRelease(hand); - } + handleTriggerPress(hand, triggerClicked); }; } - that.triggerMapping.from(Controller.Standard.RT).peek().to(makeTriggerHandler(Controller.Standard.RightHand)); - that.triggerMapping.from(Controller.Standard.LT).peek().to(makeTriggerHandler(Controller.Standard.LeftHand)); + function makeClickHandler(hand) { + return function (clicked) { + handleTriggerPress(hand, clicked); + }; + } + that.triggerPressMapping.from(Controller.Standard.RT).peek().to(makePressHandler(Controller.Standard.RightHand)); + that.triggerPressMapping.from(Controller.Standard.LT).peek().to(makePressHandler(Controller.Standard.LeftHand)); + that.triggerMapping.from(Controller.Standard.RTClick).peek().to(makeClickHandler(Controller.Standard.RightHand)); + that.triggerMapping.from(Controller.Standard.LTClick).peek().to(makeClickHandler(Controller.Standard.LeftHand)); // FUNCTION DEF(s): Intersection Check Helpers function testRayIntersect(queryRay, overlayIncludes, overlayExcludes) { From 4a722a62f7a106c7603a1cb8d4e6f5ad739729f8 Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 31 Jul 2018 11:51:16 -0700 Subject: [PATCH 5/7] use click handler only, remove triggerClicked --- .../controllerModules/inEditMode.js | 25 ++--- .../system/libraries/entitySelectionTool.js | 91 ++++++------------- 2 files changed, 37 insertions(+), 79 deletions(-) diff --git a/scripts/system/controllers/controllerModules/inEditMode.js b/scripts/system/controllers/controllerModules/inEditMode.js index e6a5efc6a2..3e53d5af12 100644 --- a/scripts/system/controllers/controllerModules/inEditMode.js +++ b/scripts/system/controllers/controllerModules/inEditMode.js @@ -66,44 +66,33 @@ Script.include("/~/system/libraries/utils.js"); this.sendPickData = function(controllerData) { if (controllerData.triggerClicks[this.hand]) { + var hand = this.hand === RIGHT_HAND ? Controller.Standard.RightHand : Controller.Standard.LeftHand; if (!this.triggerClicked) { this.selectedTarget = controllerData.rayPicks[this.hand]; if (!this.selectedTarget.intersects) { Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ - method: "clearSelection" + method: "clearSelection", + hand: hand })); } - Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ - method: "triggerClicked", - clicked: true, - rightHand: this.hand === RIGHT_HAND - })); } if (this.selectedTarget.type === Picks.INTERSECTED_ENTITY) { if (!this.isTabletMaterialEntity(this.selectedTarget.objectID)) { Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ method: "selectEntity", - entityID: this.selectedTarget.objectID + entityID: this.selectedTarget.objectID, + hand: hand })); } } else if (this.selectedTarget.type === Picks.INTERSECTED_OVERLAY) { Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ method: "selectOverlay", - overlayID: this.selectedTarget.objectID + overlayID: this.selectedTarget.objectID, + hand: hand })); } this.triggerClicked = true; - } else { - if (this.triggerClicked) { - Messages.sendLocalMessage("entityToolUpdates", JSON.stringify({ - method: "triggerClicked", - clicked: false, - rightHand: this.hand === RIGHT_HAND - })); - } - - this.triggerClicked = false; } this.sendPointingAtData(controllerData); diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index 96dc9d676b..dedc1c4811 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -53,26 +53,24 @@ SelectionManager = (function() { } if (messageParsed.method === "selectEntity") { - if (wantDebug) { - print("setting selection to " + messageParsed.entityID); + if (!SelectionDisplay.triggered() || SelectionDisplay.triggeredHand === messageParsed.hand) { + if (wantDebug) { + print("setting selection to " + messageParsed.entityID); + } + that.setSelections([messageParsed.entityID]); } - that.setSelections([messageParsed.entityID]); } else if (messageParsed.method === "clearSelection") { - that.clearSelections(); + if (!SelectionDisplay.triggered() || SelectionDisplay.triggeredHand === messageParsed.hand) { + that.clearSelections(); + } } else if (messageParsed.method === "pointingAt") { - if (messageParsed.rightHand) { + if (messageParsed.hand === Controller.Standard.RightHand) { that.pointingAtDesktopWindowRight = messageParsed.desktopWindow; that.pointingAtTabletRight = messageParsed.tablet; } else { that.pointingAtDesktopWindowLeft = messageParsed.desktopWindow; that.pointingAtTabletLeft = messageParsed.tablet; } - } else if (messageParsed.method === "triggerClicked") { - if (messageParsed.rightHand) { - that.triggerClickedRight = messageParsed.clicked; - } else { - that.triggerClickedLeft = messageParsed.clicked; - } } } @@ -115,9 +113,6 @@ SelectionManager = (function() { that.pointingAtDesktopWindowRight = false; that.pointingAtTabletLeft = false; that.pointingAtTabletRight = false; - - that.triggerClickedRight = false; - that.triggerClickedLeft = false; that.saveProperties = function() { that.savedProperties = {}; @@ -761,62 +756,36 @@ SelectionDisplay = (function() { // We get mouseMoveEvents from the handControllers, via handControllerPointer. // But we dont' get mousePressEvents. that.triggerMapping = Controller.newMapping(Script.resolvePath('') + '-click'); - that.triggerPressMapping = Controller.newMapping(Script.resolvePath('') + '-press'); Script.scriptEnding.connect(that.triggerMapping.disable); that.triggeredHand = NO_TRIGGER_HAND; that.triggered = function() { return that.triggeredHand !== NO_TRIGGER_HAND; } - function triggerPress(hand) { - var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && - SelectionManager.pointingAtDesktopWindowRight) || - (hand === Controller.Standard.LeftHand && - SelectionManager.pointingAtDesktopWindowLeft); - var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || - (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); - if (pointingAtDesktopWindow || pointingAtTablet) { - return; - } - that.triggeredHand = hand; - that.mousePressEvent({}); - } - function triggerRelease(hand) { - that.triggeredHand = NO_TRIGGER_HAND; - that.mouseReleaseEvent({}); - var otherTriggerClicked = hand == Controller.Standard.RightHand ? SelectionManager.triggerClickedLeft : - SelectionManager.triggerClickedRight; - // When one hand is released check if the other hand is clicked and should then trigger a press - if (otherTriggerClicked) { - var otherHand = hand == Controller.Standard.RightHand ? Controller.Standard.LeftHand : - Controller.Standard.RightHand; - triggerPress(otherHand); - } - } - function handleTriggerPress(hand, triggerClicked) { - // Don't allow both hands to trigger at the same time - if (that.triggered() && hand !== that.triggeredHand) { - return; - } - if (!that.triggered() && triggerClicked) { - triggerPress(hand); - } else if (that.triggered() && !triggerClicked) { - triggerRelease(hand); - } - } - function makePressHandler(hand) { - return function (value) { - var triggerClicked = hand == Controller.Standard.RightHand ? SelectionManager.triggerClickedRight : - SelectionManager.triggerClickedLeft; - handleTriggerPress(hand, triggerClicked); - }; - } function makeClickHandler(hand) { return function (clicked) { - handleTriggerPress(hand, clicked); + print("DBACK TEST makeClickHandler " + hand + " " + clicked); + // Don't allow both hands to trigger at the same time + if (that.triggered() && hand !== that.triggeredHand) { + return; + } + if (!that.triggered() && clicked) { + var pointingAtDesktopWindow = (hand === Controller.Standard.RightHand && + SelectionManager.pointingAtDesktopWindowRight) || + (hand === Controller.Standard.LeftHand && + SelectionManager.pointingAtDesktopWindowLeft); + var pointingAtTablet = (hand === Controller.Standard.RightHand && SelectionManager.pointingAtTabletRight) || + (hand === Controller.Standard.LeftHand && SelectionManager.pointingAtTabletLeft); + if (pointingAtDesktopWindow || pointingAtTablet) { + return; + } + that.triggeredHand = hand; + that.mousePressEvent({}); + } else if (that.triggered() && !clicked) { + that.triggeredHand = NO_TRIGGER_HAND; + that.mouseReleaseEvent({}); + } }; } - that.triggerPressMapping.from(Controller.Standard.RT).peek().to(makePressHandler(Controller.Standard.RightHand)); - that.triggerPressMapping.from(Controller.Standard.LT).peek().to(makePressHandler(Controller.Standard.LeftHand)); that.triggerMapping.from(Controller.Standard.RTClick).peek().to(makeClickHandler(Controller.Standard.RightHand)); that.triggerMapping.from(Controller.Standard.LTClick).peek().to(makeClickHandler(Controller.Standard.LeftHand)); From ad9ec267817865dfd3ece04344cea406d5636f9c Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 31 Jul 2018 11:53:17 -0700 Subject: [PATCH 6/7] print --- scripts/system/libraries/entitySelectionTool.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index dedc1c4811..297ee7bb36 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -763,7 +763,6 @@ SelectionDisplay = (function() { } function makeClickHandler(hand) { return function (clicked) { - print("DBACK TEST makeClickHandler " + hand + " " + clicked); // Don't allow both hands to trigger at the same time if (that.triggered() && hand !== that.triggeredHand) { return; From e8068fea0a2f495318ea781b0492a983af9509bd Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 31 Jul 2018 17:18:35 -0700 Subject: [PATCH 7/7] block selecting overlays with other hand --- scripts/system/edit.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 4b8abff84b..52af3e3a7e 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -963,13 +963,15 @@ function handleOverlaySelectionToolUpdates(channel, message, sender) { var data = JSON.parse(message); if (data.method === "selectOverlay") { - if (wantDebug) { - print("setting selection to overlay " + data.overlayID); - } - var entity = entityIconOverlayManager.findEntity(data.overlayID); + if (!selectionDisplay.triggered() || selectionDisplay.triggeredHand === data.hand) { + if (wantDebug) { + print("setting selection to overlay " + data.overlayID); + } + var entity = entityIconOverlayManager.findEntity(data.overlayID); - if (entity !== null) { - selectionManager.setSelections([entity]); + if (entity !== null) { + selectionManager.setSelections([entity]); + } } } }