Skip to content

Commit

Permalink
Merge pull request #113 from cynack/fix/webxr_unnecessary_arbutton
Browse files Browse the repository at this point in the history
fix: WebXR起動時のARボタンを削除
  • Loading branch information
futahei authored May 16, 2022
2 parents b8ad942 + c0eebc3 commit eb61840
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
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

0 comments on commit eb61840

Please sign in to comment.