Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'master' into patch-3
  • Loading branch information
dmarcos authored Nov 22, 2024
commit f42ed8a8c2d368bf93b016c5d27b24ee380c05e9
41 changes: 32 additions & 9 deletions src/components/cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

update: function (oldData) {
if (this.data.rayOrigin === oldData.rayOrigin) { return; }
if (this.data.rayOrigin === "entity") { this.updateOriginAndDirection(); }
if (this.data.rayOrigin === 'entity') { this.resetRaycaster(); }
this.updateMouseEventListeners();
// Update the WebXR event listeners if needed
if (this.data.rayOrigin === 'xrselect') {
Expand Down Expand Up @@ -221,14 +221,37 @@
this.updateCanvasBounds();
},

updateOriginAndDirection: function () {
var rayCasterConfig = {
direction: new THREE.Vector3(),
origin: new THREE.Vector3(),
};
rayCasterConfig.direction.set(0,0,-1);
rayCasterConfig.origin.set(0,0,0);
this.el.setAttribute('raycaster', rayCasterConfig);
resetRaycaster: function () {
this.el.setAttribute('raycaster', {
direction: new THREE.Vector3().set(0, 0, -1),
origin: new THREE.Vector3()
});
},

Check failure on line 230 in src/components/cursor.js

View workflow job for this annotation

GitHub Actions / Test Cases (20.x, latest)

Trailing spaces not allowed
addWebXREventListeners: function () {
var self = this;
var xrSession = this.el.sceneEl.xrSession;
if (xrSession) {
WEBXR_EVENTS.DOWN.forEach(function (downEvent) {
xrSession.addEventListener(downEvent, self.onCursorDown);
});
WEBXR_EVENTS.UP.forEach(function (upEvent) {
xrSession.addEventListener(upEvent, self.onCursorUp);
});
}
},

removeWebXREventListeners: function () {
var self = this;
var xrSession = this.el.sceneEl.xrSession;
if (xrSession) {
WEBXR_EVENTS.DOWN.forEach(function (downEvent) {
xrSession.removeEventListener(downEvent, self.onCursorDown);
});
WEBXR_EVENTS.UP.forEach(function (upEvent) {
xrSession.removeEventListener(upEvent, self.onCursorUp);
});
}
},

onMouseMove: (function () {
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.