diff --git a/index.html b/index.html
index 580f2c1..767fa6e 100644
--- a/index.html
+++ b/index.html
@@ -177,7 +177,6 @@
タイトル
}
figni-viewer {
width: 100%;
- height: 500px;
--figni-viewer-primary: #e7b56a;
--figni-viewer-secondary: #51a2ff;
--figni-viewer-background: #faeac9;
diff --git a/src/figni-viewer-base.js b/src/figni-viewer-base.js
index aad557e..283f59e 100644
--- a/src/figni-viewer-base.js
+++ b/src/figni-viewer-base.js
@@ -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"]) {
diff --git a/src/figni-viewer.js b/src/figni-viewer.js
index 1a63fe5..35be5aa 100644
--- a/src/figni-viewer.js
+++ b/src/figni-viewer.js
@@ -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) => {
diff --git a/src/style.scss b/src/style.scss
index 737bc99..ac55869 100644
--- a/src/style.scss
+++ b/src/style.scss
@@ -13,6 +13,7 @@ figni-viewer {
flex-direction: column;
height: 100%;
width: 0;
+ min-height: 1px;
}
--figni-viewer-primary: #ff733b;
--figni-viewer-secondary: #3b5eff;