diff --git a/CHANGELOG.md b/CHANGELOG.md index 4828b1c..32303c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added - 使い方を紹介しているヘルプページを追加 +- WebXR の起動をサポート ### Changed diff --git a/src/figni-viewer-base.js b/src/figni-viewer-base.js index 34fb392..569bc2e 100644 --- a/src/figni-viewer-base.js +++ b/src/figni-viewer-base.js @@ -222,8 +222,7 @@ export default class FigniViewerBaseElement extends ModelViewerElement { this.loading = 'lazy' this.cameraControls = true this.ar = true - // ! 一時的にWebXRを起動しないようにします - this.arModes = 'scene-viewer quick-look' + this.arModes = 'webxr scene-viewer quick-look' this.arScale = 'fixed' this.arPlacement = 'floor' this.shadowIntensity = 1 diff --git a/src/figni-viewer.js b/src/figni-viewer.js index 0ee2b30..f6b0e23 100644 --- a/src/figni-viewer.js +++ b/src/figni-viewer.js @@ -982,10 +982,15 @@ export default class FigniViewerElement extends HTMLElement { this.#arButton = document.createElement('span') this.#arButton.innerHTML = `${SVG_AR_BUTTON}${this.ABTEST.AR_BUTTON_TEST}` this.#arButton.classList.add('figni-viewer-ar-button') - this.#arButton.addEventListener('click', () => { + this.#figniViewerBase.addEventListener('load', () => { if (this.#figniViewerBase.canActivateAR) { - this.#figniViewerBase.activateARMode() + this.#arButton.setAttribute('slot', 'ar-button') } else { + this.#arButton.removeAttribute('slot') + } + }) + this.#arButton.addEventListener('click', () => { + if (!this.#figniViewerBase.canActivateAR) { this.#showQRCodePanel() } })