From 34ad27bf0675825e01c45713ca88c8eb4cc177d6 Mon Sep 17 00:00:00 2001 From: Alexander Goryushkin Date: Thu, 16 Nov 2023 15:30:15 -0300 Subject: [PATCH] hide also cursor-teleport in screenshot --- src/components/screentock.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/screentock.js b/src/components/screentock.js index a37452177..e41261a2b 100644 --- a/src/components/screentock.js +++ b/src/components/screentock.js @@ -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) => { @@ -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;