From ebd347fc15e683d6b57ae66a07e31f5dc3460d76 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 20 Dec 2016 14:46:55 -0800 Subject: [PATCH] only respect release of secondary for hold once pressed --- scripts/system/controllers/handControllerGrab.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 040b083a69..1f536b9567 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1470,6 +1470,7 @@ function MyController(hand) { this.grabbedOverlay = null; this.isInitialGrab = false; this.shouldResetParentOnRelease = false; + this.preparingHoldRelease = false; this.checkForStrayChildren(); @@ -2151,10 +2152,19 @@ function MyController(hand) { if (this.state == STATE_HOLD) { - if (this.secondaryReleased()) { + if (this.secondarySqueezed()) { + // this.secondaryReleased() will always be true when not depressed + // so we cannot simply rely on that for release - ensure that the + // trigger was first "prepared" by being pushed in before the release + this.preparingHoldRelease = true; + } + + if (this.preparingHoldRelease && this.secondaryReleased()) { // we have an equipped object and the secondary trigger was released // short-circuit the other checks and release it - this.release() + this.preparingHoldRelease = false; + + this.release(); return; }