From 4a72ed16162a09ba86d09b812ce7d187d07b7061 Mon Sep 17 00:00:00 2001 From: Ada Rose Cannon Date: Tue, 12 Jul 2022 09:47:06 +0100 Subject: [PATCH 1/3] Don't use the cursor component if you need to render the controllers yourself --- src/components/cursor.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/cursor.js b/src/components/cursor.js index 9e9c90fb899..a516afdf248 100644 --- a/src/components/cursor.js +++ b/src/components/cursor.js @@ -285,6 +285,13 @@ module.exports.Component = registerComponent('cursor', { } if (this.data.rayOrigin === 'xrselect' && evt.type === 'selectstart') { + // The controller is one that needs to be rendered by the environment + // the cursor behaviour should be handled by the developer + if ( + (evt.inputSource.targetRayMode === 'tracked-pointer') && + (this.el.sceneEl.xrSession.environmentBlendMode === 'opaque') + ) { return; } + this.activeXRInput = evt.inputSource; this.onMouseMove(evt); this.el.components.raycaster.checkIntersections(); @@ -315,6 +322,13 @@ module.exports.Component = registerComponent('cursor', { onCursorUp: function (evt) { if (!this.isCursorDown) { return; } + // If there is no activeInput being pressed or it is not + // the last pressed input then ignore it + if ( + data.rayOrigin === 'xrselect' && + this.activeXRInput !== evt.inputSource + ) { return; } + this.isCursorDown = false; var data = this.data; From 54ae26e86cab3eaff4916633d082c77d2ed4a9dc Mon Sep 17 00:00:00 2001 From: Ada Rose Cannon Date: Tue, 12 Jul 2022 14:06:49 +0100 Subject: [PATCH 2/3] data in wrong place --- src/components/cursor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/cursor.js b/src/components/cursor.js index a516afdf248..b7ec74eb7a5 100644 --- a/src/components/cursor.js +++ b/src/components/cursor.js @@ -320,6 +320,8 @@ module.exports.Component = registerComponent('cursor', { * in case user mousedowned one entity, dragged to another, and mouseupped. */ onCursorUp: function (evt) { + var data = this.data; + if (!this.isCursorDown) { return; } // If there is no activeInput being pressed or it is not @@ -330,9 +332,7 @@ module.exports.Component = registerComponent('cursor', { ) { return; } this.isCursorDown = false; - - var data = this.data; - this.twoWayEmit(EVENTS.MOUSEUP, evt); + this.twoWayEmit(EVENTS.MOUSEUP); if (this.reenableARHitTest === true) { this.el.sceneEl.setAttribute('ar-hit-test', 'enabled', true); From 4031bf1896c94dbc2fe475fa5522a2a6c95958cb Mon Sep 17 00:00:00 2001 From: Ada Rose Cannon Date: Thu, 18 Aug 2022 15:47:26 +0100 Subject: [PATCH 3/3] fix tests --- src/components/cursor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/cursor.js b/src/components/cursor.js index b7ec74eb7a5..853e35fc000 100644 --- a/src/components/cursor.js +++ b/src/components/cursor.js @@ -332,7 +332,7 @@ module.exports.Component = registerComponent('cursor', { ) { return; } this.isCursorDown = false; - this.twoWayEmit(EVENTS.MOUSEUP); + this.twoWayEmit(EVENTS.MOUSEUP, evt); if (this.reenableARHitTest === true) { this.el.sceneEl.setAttribute('ar-hit-test', 'enabled', true);