Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 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 @@ -313,11 +320,18 @@ 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; }

this.isCursorDown = false;
// 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; }

var data = this.data;
this.isCursorDown = false;
this.twoWayEmit(EVENTS.MOUSEUP, evt);

if (this.reenableARHitTest === true) {
Expand Down