From 0ec8071288b55546fbe668521fd59b27427793a2 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Thu, 2 Feb 2017 23:16:39 +0000 Subject: [PATCH] better scrolling and fixed button touching --- scripts/system/controllers/handControllerGrab.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 86820c990a..d242d4ccf7 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -2911,7 +2911,7 @@ function MyController(hand) { var pos3D = intersectInfo.point; if (this.state == STATE_OVERLAY_STYLUS_TOUCHING && - !this.deadspotExpired && + !this.tabletStabbed && intersectInfo.distance < WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_TOO_CLOSE) { // they've stabbed the tablet, don't send events until they pull back this.tabletStabbed = true; @@ -2919,8 +2919,15 @@ function MyController(hand) { this.tabletStabbedPos3D = pos3D; return; } + if (this.tabletStabbed) { - return; + var origin = {x: this.tabletStabbedPos2D.x, y: this.tabletStabbedPos2D.y, z: 0}; + var point = {x: pos2D.x, y: pos2D.y, z: 0}; + var offset = Vec3.distance(origin, point); + var radius = 0.05; + if (offset < radius) { + return; + } } if (Overlays.keyboardFocusOverlay != this.grabbedOverlay) {