Skip to content

Commit 7ef3ca3

Browse files
committed
refactor: only add ar-hit-test if not disabled
This conforms to the proper pattern of only adding webxr features through systems/components
1 parent 8e1e51e commit 7ef3ca3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
renderer="antialias: true; maxCanvasWidth: 3840; maxCanvasHeight: 3840;"
5151
webxr="optionalFeatures: dom-overlay, computerVision, mesh-detection, plane-detection; overlayElement: overlay;"
5252
webxr-device-manager
53-
ar-hit-test="enabled:true; src: static/images/blank-pixel.png; mapSize: 0.005 0.005;"
54-
ar-hit-test-listener
5553
gltf-model="dracoDecoderPath: /static/vendor/draco-1.5.4/;"
5654
inspector="url: static/vendor/aframe-inspector.min.js;"
5755
xr-mode-ui="XRMode:xr"

src/systems/core/arena.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,13 @@ AFRAME.registerSystem('arena-scene', {
680680
}, 10);
681681
}
682682

683-
if (sceneOptions['ar-hit-test']?.enabled === false) {
684-
sceneEl.removeAttribute('ar-hit-test-listener');
685-
sceneEl.removeAttribute('ar-hit-test');
683+
if (sceneOptions['ar-hit-test']?.enabled !== false) {
684+
sceneEl.setAttribute('ar-hit-test', {
685+
enabled: true,
686+
src: 'static/images/blank-pixel.png',
687+
mapSize: { x: 0.005, y: 0.005 },
688+
});
689+
sceneEl.setAttribute('ar-hit-test-listener', { enabled: true });
686690
}
687691

688692
// deal with scene attribution

0 commit comments

Comments
 (0)