Skip to content

Commit 1cb2d2a

Browse files
committed
Don't use the cursor component if you need to render the controllers yourself
1 parent fb9beae commit 1cb2d2a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/components/cursor.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,13 @@ module.exports.Component = registerComponent('cursor', {
285285
}
286286

287287
if (this.data.rayOrigin === 'xrselect' && evt.type === 'selectstart') {
288+
// The controller is one that needs to be rendered by the environment
289+
// the cursor behaviour should be handled by the developer
290+
if (
291+
(evt.inputSource.targetRayMode === 'tracked-pointer') &&
292+
(this.el.sceneEl.xrSession.environmentBlendMode === 'opaque')
293+
) { return; }
294+
288295
this.activeXRInput = evt.inputSource;
289296
this.onMouseMove(evt);
290297
this.el.components.raycaster.checkIntersections();
@@ -315,6 +322,13 @@ module.exports.Component = registerComponent('cursor', {
315322
onCursorUp: function (evt) {
316323
if (!this.isCursorDown) { return; }
317324

325+
// If there is no activeInput being pressed or it is not
326+
// the last pressed input then ignore it
327+
if (
328+
data.rayOrigin === 'xrselect' &&
329+
this.activeXRInput !== evt.inputSource
330+
) { return; }
331+
318332
this.isCursorDown = false;
319333

320334
var data = this.data;

0 commit comments

Comments
 (0)