Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: WebXR起動時のARボタンを削除 #113

Merged
merged 4 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added

- 使い方を紹介しているヘルプページを追加
- WebXR の起動をサポート

### Changed

Expand Down
3 changes: 1 addition & 2 deletions src/figni-viewer-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/figni-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -982,10 +982,15 @@ export default class FigniViewerElement extends HTMLElement {
this.#arButton = document.createElement('span')
this.#arButton.innerHTML = `${SVG_AR_BUTTON}<span>${this.ABTEST.AR_BUTTON_TEST}</span>`
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()
}
})
Expand Down