Skip to content

Commit

Permalink
Merge pull request #148 from cynack/fix/hide_loading_panel
Browse files Browse the repository at this point in the history
fix: 3D表示画面にmin-heightを設定
  • Loading branch information
futahei authored Jul 5, 2022
2 parents 2b73325 + 7718ca9 commit 79777bf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ <h4>タイトル</h4>
}
figni-viewer {
width: 100%;
height: 500px;
--figni-viewer-primary: #e7b56a;
--figni-viewer-secondary: #51a2ff;
--figni-viewer-background: #faeac9;
Expand Down
9 changes: 2 additions & 7 deletions src/figni-viewer-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@ export default class FigniViewerBaseElement extends ModelViewerElement {
#abtest = {}
#events = {}

constructor() {
super()

// model-viewer setup
this.#setupModelViewer()
}

async connectedCallback() {
super.connectedCallback()

this.#setupModelViewer()

const style = document.createElement('style')
style.textContent = `
:not(style[outline="none"]) {
Expand Down
12 changes: 6 additions & 6 deletions src/figni-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,28 +165,28 @@ export default class FigniViewerElement extends HTMLElement {

async connectedCallback() {
// Figni Viewer Base
if (!this.#figniViewerBase) {
if (!this.base) {
this.#figniViewerBase = document.createElement('figni-viewer-base')
// イベントの登録
this.#figniViewerBase.addEventListener('load', () => {
this.base.addEventListener('load', () => {
this.dispatchEvent(new CustomEvent('load'))
})
this.#figniViewerBase.addEventListener('progress', (e) => {
this.base.addEventListener('progress', (e) => {
this.dispatchEvent(
new CustomEvent('progress', {
detail: { progress: e.detail.totalProgress },
})
)
})
this.#figniViewerBase.addEventListener('finished', () => {
this.base.addEventListener('finished', () => {
this.dispatchEvent(new CustomEvent('animation-finished'))
})
this.#figniViewerBase.addEventListener('camera-change', (e) => {
this.base.addEventListener('camera-change', (e) => {
this.dispatchEvent(
new CustomEvent('camera-change', { detail: e.detail })
)
})
this.appendChild(this.#figniViewerBase)
this.appendChild(this.base)
}

this.addEventListener('camera-change', (e) => {
Expand Down
1 change: 1 addition & 0 deletions src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ figni-viewer {
flex-direction: column;
height: 100%;
width: 0;
min-height: 1px;
}
--figni-viewer-primary: #ff733b;
--figni-viewer-secondary: #3b5eff;
Expand Down

0 comments on commit 79777bf

Please sign in to comment.