Skip to content

Commit

Permalink
hide also cursor-teleport in screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorush committed Nov 16, 2023
1 parent 5763cef commit 34ad27b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/screentock.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ AFRAME.registerComponent('screentock', {

function toggleHelpers(show) {
if (inspector && inspector.opened) inspector.sceneHelpers.visible = show;
if (show) {
document.querySelector('#cameraRig')
.setAttribute('cursor-teleport', "cameraRig: #cameraRig; cameraHead: #camera;");
} else {
document.querySelector('#cameraRig').removeAttribute('cursor-teleport');
}
}

const createCanvasWithScreenshot = async (aframeCanvas) => {
Expand Down Expand Up @@ -109,7 +115,11 @@ AFRAME.registerComponent('screentock', {
// show helpers
toggleHelpers(true);
},
update: function () {
update: function (oldData) {
// If `oldData` is empty, then this means we're in the initialization process.
// No need to update.
if (Object.keys(oldData).length === 0) { return; }

// this should be paused when not in use. could be throttled too
if (this.data.takeScreenshot) {
this.data.takeScreenshot = false;
Expand Down

0 comments on commit 34ad27b

Please sign in to comment.