From 28dac9d80234123e8b318103a37229832bbe6bf5 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 18 Jan 2017 10:52:14 -0800 Subject: [PATCH 1/5] Lasers now interact with the tablet in edit mode. --- scripts/system/controllers/handControllerGrab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index b9b5b5f7a8..67033a1ab1 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1910,7 +1910,7 @@ function MyController(hand) { Overlays.sendHoverOverOverlay(overlay, pointerEvent); } - if (this.triggerSmoothedGrab() && !isEditing()) { + if (this.triggerSmoothedGrab()) { this.grabbedOverlay = overlay; this.setState(STATE_OVERLAY_LASER_TOUCHING, "begin touching overlay '" + overlay + "'"); return true; From 448e3fda0c9aee033e5d96d1def7face7aaebd39 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 18 Jan 2017 10:53:11 -0800 Subject: [PATCH 2/5] fix for JSON parse exception --- scripts/system/tablet-ui/tabletUI.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index 14fe4d649f..abddc4c084 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -60,7 +60,9 @@ } function toggleHand(channel, hand, senderUUID, localOnly) { - activeHand = JSON.parse(hand); + if (channel === "toggleHand") { + activeHand = JSON.parse(hand); + } } Messages.subscribe("toggleHand"); From fc5c2c8def457117ae4f58e0f3c737a4264aeb9d Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 18 Jan 2017 13:16:47 -0800 Subject: [PATCH 3/5] Fix for glitchy scrolling --- scripts/system/controllers/handControllerGrab.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 67033a1ab1..770f75e610 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -311,9 +311,11 @@ function projectOntoOverlayXYPlane(overlayID, worldPos) { var resolution = Overlays.getProperty(overlayID, "resolution"); resolution.z = 1; // Circumvent divide-by-zero. var scale = Overlays.getProperty(overlayID, "dimensions"); + scale.z = 0.01; // overlay dimensions are 2D, not 3D. dimensions = Vec3.multiplyVbyV(Vec3.multiply(resolution, INCHES_TO_METERS / dpi), scale); } else { dimensions = Overlays.getProperty(overlayID, "dimensions"); + dimensions.z = 0.01; // overlay dimensions are 2D, not 3D. } return projectOntoXYPlane(worldPos, position, rotation, dimensions, DEFAULT_REGISTRATION_POINT); From bcd94203e68c68b0bf287b685b6b39a45e32531e Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 18 Jan 2017 13:26:32 -0800 Subject: [PATCH 4/5] Raised min fps of tablet overlay for smoother scrolling --- interface/src/ui/overlays/Web3DOverlay.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index f052081cc6..bf708c738d 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -154,6 +154,9 @@ void Web3DOverlay::loadSourceURL() { auto flags = tabletScriptingInterface->getFlags(); _webSurface->getRootContext()->setContextProperty("offscreenFlags", flags); tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data()); + + // Override min fps for tablet UI, for silky smooth scrolling + _webSurface->setMaxFps(90); } } _webSurface->getRootContext()->setContextProperty("globalPosition", vec3toVariant(getPosition())); From 56c897cc2faccc60c38b9a625a1956112bba4ad9 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Wed, 18 Jan 2017 15:30:38 -0800 Subject: [PATCH 5/5] Process the tablet stylus even when reticle is over 2d HUD overlay. --- .../system/controllers/handControllerGrab.js | 63 +++++++++++-------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 770f75e610..d2f39f93de 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -828,6 +828,12 @@ function MyController(hand) { } if (this.ignoreInput()) { + + // Most hand input is disabled, because we are interacting with the 2d hud. + // However, we still should check for collisions of the stylus with the web overlay. + var controllerLocation = getControllerWorldLocation(this.handToController(), true); + this.processStylus(controllerLocation.position); + this.turnOffVisualizations(); return; } @@ -1155,6 +1161,36 @@ function MyController(hand) { return _this.rawThumbValue < THUMB_ON_VALUE; }; + this.processStylus = function(worldHandPosition) { + // see if the hand is near a tablet or web-entity + var candidateEntities = Entities.findEntities(worldHandPosition, WEB_DISPLAY_STYLUS_DISTANCE); + entityPropertiesCache.addEntities(candidateEntities); + var nearWeb = false; + for (var i = 0; i < candidateEntities.length; i++) { + var props = entityPropertiesCache.getProps(candidateEntities[i]); + if (props && (props.type == "Web" || this.isTablet(props))) { + nearWeb = true; + break; + } + } + + if (nearWeb) { + this.showStylus(); + var rayPickInfo = this.calcRayPickInfo(this.hand); + if (rayPickInfo.distance < WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET) { + if (this.handleStylusOnWebEntity(rayPickInfo)) { + return; + } + if (this.handleStylusOnWebOverlay(rayPickInfo)) { + return; + } + this.handleStylusOnHomeButton(rayPickInfo); + } + } else { + this.hideStylus(); + } + }; + this.off = function(deltaTime, timestamp) { this.checkForUnexpectedChildren(); @@ -1202,32 +1238,7 @@ function MyController(hand) { this.grabPointSphereOff(); } - // see if the hand is near a tablet or web-entity - candidateEntities = Entities.findEntities(worldHandPosition, WEB_DISPLAY_STYLUS_DISTANCE); - var nearWeb = false; - for (var i = 0; i < candidateEntities.length; i++) { - var props = entityPropertiesCache.getProps(candidateEntities[i]); - if (props && (props.type == "Web" || this.isTablet(props))) { - nearWeb = true; - break; - } - } - - if (nearWeb) { - this.showStylus(); - var rayPickInfo = this.calcRayPickInfo(this.hand); - if (rayPickInfo.distance < WEB_STYLUS_LENGTH / 2.0 + WEB_TOUCH_Y_OFFSET) { - if (this.handleStylusOnWebEntity(rayPickInfo)) { - return; - } - if (this.handleStylusOnWebOverlay(rayPickInfo)) { - return; - } - this.handleStylusOnHomeButton(rayPickInfo); - } - } else { - this.hideStylus(); - } + this.processStylus(worldHandPosition); }; this.handleStylusOnHomeButton = function(rayPickInfo) {