Skip to content

Commit

Permalink
Don't use the cursor component if you need to render the controllers …
Browse files Browse the repository at this point in the history
…yourself
  • Loading branch information
AdaRoseCannon committed Jul 12, 2022
1 parent fb9beae commit 1cb2d2a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1cb2d2a

Please sign in to comment.