@xviewer.js/debug 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -1,9 +1,9 @@
1
- import { Viewer, property, ObjectInstance, Mount, PropertyManager, Component, BoxProjection } from '@xviewer.js/core';
2
- import { MeshBasicMaterial, WebGLRenderer, Material, MeshStandardMaterial, MeshPhysicalMaterial, Scene, OrthographicCamera, Sprite, Vector3, ShaderMaterial, Box3, Box3Helper } from 'three';
1
+ import { Texture, Material, MeshBasicMaterial, MeshStandardMaterial, MeshPhysicalMaterial, Scene, OrthographicCamera, Sprite, Vector3, ShaderMaterial, Box3, Box3Helper } from 'three';
2
+ import { property, ObjectInstance, Mount, PropertyManager, Component, BoxProjection } from '@xviewer.js/core';
3
3
 
4
4
  var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
5
5
 
6
- var css = "@charset \"UTF-8\";\n.lil-gui {\n font-family: var(--font-family);\n font-size: var(--font-size);\n line-height: 1;\n font-weight: normal;\n font-style: normal;\n text-align: left;\n background-color: var(--background-color);\n color: var(--text-color);\n user-select: none;\n -webkit-user-select: none;\n touch-action: manipulation;\n --background-color: #1f1f1f;\n --text-color: #ebebeb;\n --title-background-color: #111111;\n --title-text-color: #ebebeb;\n --widget-color: #424242;\n --hover-color: #4f4f4f;\n --focus-color: #595959;\n --number-color: #2cc9ff;\n --string-color: #a2db3c;\n --font-size: 11px;\n --input-font-size: 11px;\n --font-family: -apple-system,\n BlinkMacSystemFont,\n \"Segoe UI\",\n Roboto,\n Arial,\n sans-serif;\n --font-family-mono: Menlo,\n Monaco,\n Consolas,\n \"Droid Sans Mono\",\n monospace;\n --padding: 4px;\n --spacing: 4px;\n --widget-height: 20px;\n --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);\n --name-width: 40%;\n --slider-knob-width: 2px;\n --slider-input-width: 27%;\n --color-input-width: 27%;\n --slider-input-min-width: 45px;\n --color-input-min-width: 45px;\n --folder-indent: 7px;\n --widget-padding: 0 0 0 3px;\n --widget-border-radius: 2px;\n --checkbox-size: calc(0.75 * var(--widget-height));\n --scrollbar-width: 5px;\n}\n.lil-gui, .lil-gui * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n.lil-gui.root {\n width: var(--width, 245px);\n display: flex;\n flex-direction: column;\n}\n.lil-gui.root > .title {\n background: var(--title-background-color);\n color: var(--title-text-color);\n}\n.lil-gui.root > .children {\n overflow-x: hidden;\n overflow-y: auto;\n}\n.lil-gui.root > .children::-webkit-scrollbar {\n width: var(--scrollbar-width);\n height: var(--scrollbar-width);\n background: var(--background-color);\n}\n.lil-gui.root > .children::-webkit-scrollbar-thumb {\n border-radius: var(--scrollbar-width);\n background: var(--focus-color);\n}\n@media (pointer: coarse) {\n .lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n }\n}\n.lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n}\n.lil-gui.autoPlace {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 1001;\n}\n\n.lil-gui .controller {\n display: flex;\n align-items: center;\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n}\n.lil-gui .controller.disabled {\n opacity: 0.5;\n}\n.lil-gui .controller.disabled, .lil-gui .controller.disabled * {\n pointer-events: none !important;\n}\n.lil-gui .controller > .name {\n min-width: var(--name-width);\n flex-shrink: 0;\n white-space: pre;\n padding-right: var(--spacing);\n line-height: var(--widget-height);\n}\n.lil-gui .controller .widget {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n min-height: var(--widget-height);\n}\n.lil-gui .controller.string input {\n color: var(--string-color);\n}\n.lil-gui .controller.boolean .widget {\n cursor: pointer;\n}\n.lil-gui .controller.color .display {\n width: 100%;\n height: var(--widget-height);\n border-radius: var(--widget-border-radius);\n position: relative;\n}\n@media (hover: hover) {\n .lil-gui .controller.color .display:hover:before {\n content: \" \";\n display: block;\n position: absolute;\n border-radius: var(--widget-border-radius);\n border: 1px solid rgba(255, 255, 255, 0.6);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n.lil-gui .controller.color input[type=color] {\n opacity: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.lil-gui .controller.color input[type=text] {\n margin-left: var(--spacing);\n font-family: var(--font-family-mono);\n min-width: var(--color-input-min-width);\n width: var(--color-input-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.option select {\n opacity: 0;\n position: absolute;\n width: 100%;\n max-width: 100%;\n}\n.lil-gui .controller.option .display {\n position: relative;\n pointer-events: none;\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n line-height: var(--widget-height);\n max-width: 100%;\n overflow: hidden;\n word-break: break-all;\n padding-left: 0.55em;\n padding-right: 1.75em;\n background: var(--widget-color);\n}\n@media (hover: hover) {\n .lil-gui .controller.option .display.focus {\n background: var(--focus-color);\n }\n}\n.lil-gui .controller.option .display.active {\n background: var(--focus-color);\n}\n.lil-gui .controller.option .display:after {\n font-family: \"lil-gui\";\n content: \"↕\";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n padding-right: 0.375em;\n}\n.lil-gui .controller.option .widget,\n.lil-gui .controller.option select {\n cursor: pointer;\n}\n@media (hover: hover) {\n .lil-gui .controller.option .widget:hover .display {\n background: var(--hover-color);\n }\n}\n.lil-gui .controller.number input {\n color: var(--number-color);\n}\n.lil-gui .controller.number.hasSlider input {\n margin-left: var(--spacing);\n width: var(--slider-input-width);\n min-width: var(--slider-input-min-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.number .slider {\n width: 100%;\n height: var(--widget-height);\n background-color: var(--widget-color);\n border-radius: var(--widget-border-radius);\n padding-right: var(--slider-knob-width);\n overflow: hidden;\n cursor: ew-resize;\n touch-action: pan-y;\n}\n@media (hover: hover) {\n .lil-gui .controller.number .slider:hover {\n background-color: var(--hover-color);\n }\n}\n.lil-gui .controller.number .slider.active {\n background-color: var(--focus-color);\n}\n.lil-gui .controller.number .slider.active .fill {\n opacity: 0.95;\n}\n.lil-gui .controller.number .fill {\n height: 100%;\n border-right: var(--slider-knob-width) solid var(--number-color);\n box-sizing: content-box;\n}\n.lil-gui .controller.image img {\n max-width: 100%;\n}\n.lil-gui .controller.image canvas {\n max-width: 100%;\n min-height: 1px;\n}\n.lil-gui .controller.vector input {\n color: var(--number-color);\n}\n.lil-gui .controller.vector .fill {\n height: 100%;\n margin-left: var(--spacing);\n box-sizing: content-box;\n}\n\n.lil-gui-dragging .lil-gui {\n --hover-color: var(--widget-color);\n}\n.lil-gui-dragging * {\n cursor: ew-resize !important;\n}\n\n.lil-gui-dragging.lil-gui-vertical * {\n cursor: ns-resize !important;\n}\n\n.lil-gui .title {\n height: var(--title-height);\n line-height: calc(var(--title-height) - 4px);\n font-weight: 600;\n padding: 0 var(--padding);\n -webkit-tap-highlight-color: transparent;\n cursor: pointer;\n outline: none;\n text-decoration-skip: objects;\n}\n.lil-gui .title:before {\n font-family: \"lil-gui\";\n content: \"▾\";\n padding-right: 2px;\n display: inline-block;\n}\n.lil-gui .title:active {\n background: var(--title-background-color);\n opacity: 0.75;\n}\n@media (hover: hover) {\n body:not(.lil-gui-dragging) .lil-gui .title:hover {\n background: var(--title-background-color);\n opacity: 0.85;\n }\n .lil-gui .title:focus {\n text-decoration: underline var(--focus-color);\n }\n}\n.lil-gui.root > .title:focus {\n text-decoration: none !important;\n}\n.lil-gui.closed > .title:before {\n content: \"▸\";\n}\n.lil-gui.closed > .children {\n transform: translateY(-7px);\n opacity: 0;\n}\n.lil-gui.closed:not(.transition) > .children {\n display: none;\n}\n.lil-gui.transition > .children {\n transition-duration: 300ms;\n transition-property: height, opacity, transform;\n transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);\n overflow: hidden;\n pointer-events: none;\n}\n.lil-gui .children:empty:before {\n content: \"Empty\";\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n display: block;\n height: var(--widget-height);\n font-style: italic;\n line-height: var(--widget-height);\n opacity: 0.5;\n}\n.lil-gui.root > .children > .lil-gui > .title {\n border: 0 solid var(--widget-color);\n border-width: 1px 0;\n transition: border-color 300ms;\n}\n.lil-gui.root > .children > .lil-gui.closed > .title {\n border-bottom-color: transparent;\n}\n.lil-gui + .controller {\n border-top: 1px solid var(--widget-color);\n margin-top: 0;\n padding-top: var(--spacing);\n}\n.lil-gui .lil-gui .lil-gui > .title {\n border: none;\n}\n.lil-gui .lil-gui .lil-gui > .children {\n border: none;\n margin-left: var(--folder-indent);\n border-left: 2px solid var(--widget-color);\n}\n.lil-gui .lil-gui .controller {\n border: none;\n}\n\n.lil-gui input {\n -webkit-tap-highlight-color: transparent;\n border: 0;\n outline: none;\n font-family: var(--font-family);\n font-size: var(--input-font-size);\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n background: var(--widget-color);\n color: var(--text-color);\n width: 100%;\n}\n@media (hover: hover) {\n .lil-gui input:hover {\n background: var(--hover-color);\n }\n .lil-gui input:active {\n background: var(--focus-color);\n }\n}\n.lil-gui input:disabled {\n opacity: 1;\n}\n.lil-gui input[type=text],\n.lil-gui input[type=number] {\n padding: var(--widget-padding);\n}\n.lil-gui input[type=text]:focus,\n.lil-gui input[type=number]:focus {\n background: var(--focus-color);\n}\n.lil-gui input::-webkit-outer-spin-button,\n.lil-gui input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.lil-gui input[type=number] {\n -moz-appearance: textfield;\n}\n.lil-gui input[type=checkbox] {\n appearance: none;\n -webkit-appearance: none;\n height: var(--checkbox-size);\n width: var(--checkbox-size);\n border-radius: var(--widget-border-radius);\n text-align: center;\n cursor: pointer;\n}\n.lil-gui input[type=checkbox]:checked:before {\n font-family: \"lil-gui\";\n content: \"✓\";\n font-size: var(--checkbox-size);\n line-height: var(--checkbox-size);\n}\n@media (hover: hover) {\n .lil-gui input[type=checkbox]:focus {\n box-shadow: inset 0 0 0 1px var(--focus-color);\n }\n}\n.lil-gui button {\n -webkit-tap-highlight-color: transparent;\n outline: none;\n cursor: pointer;\n font-family: var(--font-family);\n font-size: var(--font-size);\n color: var(--text-color);\n width: 100%;\n height: var(--widget-height);\n text-transform: none;\n background: var(--widget-color);\n border-radius: var(--widget-border-radius);\n border: 1px solid var(--widget-color);\n text-align: center;\n line-height: calc(var(--widget-height) - 4px);\n}\n@media (hover: hover) {\n .lil-gui button:hover {\n background: var(--hover-color);\n border-color: var(--hover-color);\n }\n .lil-gui button:focus {\n border-color: var(--focus-color);\n }\n}\n.lil-gui button:active {\n background: var(--focus-color);\n}\n\n@font-face {\n font-family: \"lil-gui\";\n src: url(\"data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==\") format(\"woff\");\n}\n.curve-editor {\n display: flex;\n flex-direction: column;\n gap: 5px;\n background-color: #303030;\n outline: 1px solid #000000;\n padding: 5px;\n width: 100%;\n}\n.curve-editor .button-medium {\n background-color: #545454;\n min-width: var(--widget-height);\n min-height: var(--widget-height);\n height: 100%;\n outline: 1px solid #3c3c3c;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n font-size: var(--input-font-size, 11px);\n}\n.curve-editor .button-medium.selected {\n background-color: #4772b3;\n pointer-events: none;\n}\n.curve-editor .button-medium:hover {\n background-color: #656565;\n cursor: default;\n}\n.curve-editor .curve-top {\n display: flex;\n width: 100%;\n}\n.curve-editor .curve-panel {\n width: 100%;\n height: 90px;\n outline: 1px solid #646464;\n}\n.curve-editor .curve-point-panel {\n display: flex;\n align-items: center;\n width: 100%;\n height: var(--widget-height);\n}\n.curve-editor .curve-point-panel input {\n background-color: #545454;\n height: 100%;\n width: 100%;\n color: #fff;\n border: 0;\n outline: 1px solid #3c3c3c;\n text-align: center;\n font-size: var(--input-font-size, 11px);\n}";
6
+ var css = "@charset \"UTF-8\";\n.lil-gui {\n font-family: var(--font-family);\n font-size: var(--font-size);\n line-height: 1;\n font-weight: normal;\n font-style: normal;\n text-align: left;\n background-color: var(--background-color);\n color: var(--text-color);\n user-select: none;\n -webkit-user-select: none;\n touch-action: manipulation;\n --background-color: #1f1f1f;\n --text-color: #ebebeb;\n --title-background-color: #111111;\n --title-text-color: #ebebeb;\n --widget-color: #424242;\n --hover-color: #4f4f4f;\n --focus-color: #595959;\n --number-color: #2cc9ff;\n --string-color: #a2db3c;\n --font-size: 11px;\n --input-font-size: 11px;\n --font-family: -apple-system,\n BlinkMacSystemFont,\n \"Segoe UI\",\n Roboto,\n Arial,\n sans-serif;\n --font-family-mono: Menlo,\n Monaco,\n Consolas,\n \"Droid Sans Mono\",\n monospace;\n --padding: 4px;\n --spacing: 4px;\n --widget-height: 20px;\n --title-height: calc(var(--widget-height) + var(--spacing) * 1.25);\n --name-width: 40%;\n --slider-knob-width: 2px;\n --slider-input-width: 27%;\n --color-input-width: 27%;\n --slider-input-min-width: 45px;\n --color-input-min-width: 45px;\n --folder-indent: 7px;\n --widget-padding: 0 0 0 3px;\n --widget-border-radius: 2px;\n --checkbox-size: calc(0.75 * var(--widget-height));\n --scrollbar-width: 5px;\n}\n.lil-gui, .lil-gui * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n.lil-gui.root {\n width: var(--width, 245px);\n display: flex;\n flex-direction: column;\n}\n.lil-gui.root > .title {\n background: var(--title-background-color);\n color: var(--title-text-color);\n}\n.lil-gui.root > .children {\n overflow-x: hidden;\n overflow-y: auto;\n}\n.lil-gui.root > .children::-webkit-scrollbar {\n width: var(--scrollbar-width);\n height: var(--scrollbar-width);\n background: var(--background-color);\n}\n.lil-gui.root > .children::-webkit-scrollbar-thumb {\n border-radius: var(--scrollbar-width);\n background: var(--focus-color);\n}\n@media (pointer: coarse) {\n .lil-gui.allow-touch-styles, .lil-gui.allow-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n }\n}\n.lil-gui.force-touch-styles, .lil-gui.force-touch-styles .lil-gui {\n --widget-height: 28px;\n --padding: 6px;\n --spacing: 6px;\n --font-size: 13px;\n --input-font-size: 16px;\n --folder-indent: 10px;\n --scrollbar-width: 7px;\n --slider-input-min-width: 50px;\n --color-input-min-width: 65px;\n}\n.lil-gui.autoPlace {\n max-height: 100%;\n position: fixed;\n top: 0;\n right: 15px;\n z-index: 1001;\n}\n\n.lil-gui .controller {\n display: flex;\n align-items: center;\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n}\n.lil-gui .controller.disabled {\n opacity: 0.5;\n}\n.lil-gui .controller.disabled, .lil-gui .controller.disabled * {\n pointer-events: none !important;\n}\n.lil-gui .controller > .name {\n min-width: var(--name-width);\n flex-shrink: 0;\n white-space: pre;\n padding-right: var(--spacing);\n line-height: var(--widget-height);\n}\n.lil-gui .controller .widget {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n min-height: var(--widget-height);\n}\n.lil-gui .controller.string input {\n color: var(--string-color);\n}\n.lil-gui .controller.boolean .widget {\n cursor: pointer;\n}\n.lil-gui .controller.color .display {\n width: 100%;\n height: var(--widget-height);\n border-radius: var(--widget-border-radius);\n position: relative;\n}\n@media (hover: hover) {\n .lil-gui .controller.color .display:hover:before {\n content: \" \";\n display: block;\n position: absolute;\n border-radius: var(--widget-border-radius);\n border: 1px solid rgba(255, 255, 255, 0.6);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n }\n}\n.lil-gui .controller.color input[type=color] {\n opacity: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.lil-gui .controller.color input[type=text] {\n margin-left: var(--spacing);\n font-family: var(--font-family-mono);\n min-width: var(--color-input-min-width);\n width: var(--color-input-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.option select {\n opacity: 0;\n position: absolute;\n width: 100%;\n max-width: 100%;\n}\n.lil-gui .controller.option .display {\n position: relative;\n pointer-events: none;\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n line-height: var(--widget-height);\n max-width: 100%;\n overflow: hidden;\n word-break: break-all;\n padding-left: 0.55em;\n padding-right: 1.75em;\n background: var(--widget-color);\n}\n@media (hover: hover) {\n .lil-gui .controller.option .display.focus {\n background: var(--focus-color);\n }\n}\n.lil-gui .controller.option .display.active {\n background: var(--focus-color);\n}\n.lil-gui .controller.option .display:after {\n font-family: \"lil-gui\";\n content: \"↕\";\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n padding-right: 0.375em;\n}\n.lil-gui .controller.option .widget,\n.lil-gui .controller.option select {\n cursor: pointer;\n}\n@media (hover: hover) {\n .lil-gui .controller.option .widget:hover .display {\n background: var(--hover-color);\n }\n}\n.lil-gui .controller.number input {\n color: var(--number-color);\n}\n.lil-gui .controller.number.hasSlider input {\n margin-left: var(--spacing);\n width: var(--slider-input-width);\n min-width: var(--slider-input-min-width);\n flex-shrink: 0;\n}\n.lil-gui .controller.number .slider {\n width: 100%;\n height: var(--widget-height);\n background-color: var(--widget-color);\n border-radius: var(--widget-border-radius);\n padding-right: var(--slider-knob-width);\n overflow: hidden;\n cursor: ew-resize;\n touch-action: pan-y;\n}\n@media (hover: hover) {\n .lil-gui .controller.number .slider:hover {\n background-color: var(--hover-color);\n }\n}\n.lil-gui .controller.number .slider.active {\n background-color: var(--focus-color);\n}\n.lil-gui .controller.number .slider.active .fill {\n opacity: 0.95;\n}\n.lil-gui .controller.number .fill {\n height: 100%;\n border-right: var(--slider-knob-width) solid var(--number-color);\n box-sizing: content-box;\n}\n.lil-gui .controller.texture canvas {\n width: 100%;\n border-radius: var(--widget-border-radius);\n}\n.lil-gui .controller.texture .group {\n display: flex;\n position: relative;\n width: 100%;\n}\n.lil-gui .controller.texture .info {\n position: absolute;\n display: flex;\n gap: 11px;\n}\n.lil-gui .controller.texture .label {\n position: absolute;\n background-color: rgba(0, 0, 0, 0.6745098039);\n display: \"flex\";\n padding: 2px;\n border-radius: var(--widget-border-radius);\n}\n.lil-gui .controller.texture .block {\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n margin-top: 2px;\n width: var(--font-size);\n height: var(--font-size);\n border-radius: var(--font-size);\n background-color: white;\n cursor: pointer;\n}\n.lil-gui .controller.texture .block.select {\n background-color: var(--string-color);\n}\n.lil-gui .controller.image img {\n width: 100%;\n}\n.lil-gui .controller.image canvas {\n width: 100%;\n}\n.lil-gui .controller.vector input {\n color: var(--number-color);\n}\n.lil-gui .controller.vector .fill {\n height: 100%;\n margin-left: var(--spacing);\n box-sizing: content-box;\n}\n\n.lil-gui-dragging .lil-gui {\n --hover-color: var(--widget-color);\n}\n.lil-gui-dragging * {\n cursor: ew-resize !important;\n}\n\n.lil-gui-dragging.lil-gui-vertical * {\n cursor: ns-resize !important;\n}\n\n.lil-gui .title {\n height: var(--title-height);\n line-height: calc(var(--title-height) - 4px);\n font-weight: 600;\n padding: 0 var(--padding);\n -webkit-tap-highlight-color: transparent;\n cursor: pointer;\n outline: none;\n text-decoration-skip: objects;\n}\n.lil-gui .title:before {\n font-family: \"lil-gui\";\n content: \"▾\";\n padding-right: 2px;\n display: inline-block;\n}\n.lil-gui .title:active {\n background: var(--title-background-color);\n opacity: 0.75;\n}\n@media (hover: hover) {\n body:not(.lil-gui-dragging) .lil-gui .title:hover {\n background: var(--title-background-color);\n opacity: 0.85;\n }\n .lil-gui .title:focus {\n text-decoration: underline var(--focus-color);\n }\n}\n.lil-gui.root > .title:focus {\n text-decoration: none !important;\n}\n.lil-gui.closed > .title:before {\n content: \"▸\";\n}\n.lil-gui.closed > .children {\n transform: translateY(-7px);\n opacity: 0;\n}\n.lil-gui.closed:not(.transition) > .children {\n display: none;\n}\n.lil-gui.transition > .children {\n transition-duration: 300ms;\n transition-property: height, opacity, transform;\n transition-timing-function: cubic-bezier(0.2, 0.6, 0.35, 1);\n overflow: hidden;\n pointer-events: none;\n}\n.lil-gui .children:empty:before {\n content: \"Empty\";\n padding: 0 var(--padding);\n margin: var(--spacing) 0;\n display: block;\n height: var(--widget-height);\n font-style: italic;\n line-height: var(--widget-height);\n opacity: 0.5;\n}\n.lil-gui.root > .children > .lil-gui > .title {\n border: 0 solid var(--widget-color);\n border-width: 1px 0;\n transition: border-color 300ms;\n}\n.lil-gui.root > .children > .lil-gui.closed > .title {\n border-bottom-color: transparent;\n}\n.lil-gui + .controller {\n border-top: 1px solid var(--widget-color);\n margin-top: 0;\n padding-top: var(--spacing);\n}\n.lil-gui .lil-gui .lil-gui > .title {\n border: none;\n}\n.lil-gui .lil-gui .lil-gui > .children {\n border: none;\n margin-left: var(--folder-indent);\n border-left: 2px solid var(--widget-color);\n}\n.lil-gui .lil-gui .controller {\n border: none;\n}\n\n.lil-gui input {\n -webkit-tap-highlight-color: transparent;\n border: 0;\n outline: none;\n font-family: var(--font-family);\n font-size: var(--input-font-size);\n border-radius: var(--widget-border-radius);\n height: var(--widget-height);\n background: var(--widget-color);\n color: var(--text-color);\n width: 100%;\n}\n@media (hover: hover) {\n .lil-gui input:hover {\n background: var(--hover-color);\n }\n .lil-gui input:active {\n background: var(--focus-color);\n }\n}\n.lil-gui input:disabled {\n opacity: 1;\n}\n.lil-gui input[type=text],\n.lil-gui input[type=number] {\n padding: var(--widget-padding);\n}\n.lil-gui input[type=text]:focus,\n.lil-gui input[type=number]:focus {\n background: var(--focus-color);\n}\n.lil-gui input::-webkit-outer-spin-button,\n.lil-gui input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n.lil-gui input[type=number] {\n -moz-appearance: textfield;\n}\n.lil-gui input[type=checkbox] {\n appearance: none;\n -webkit-appearance: none;\n height: var(--checkbox-size);\n width: var(--checkbox-size);\n border-radius: var(--widget-border-radius);\n text-align: center;\n cursor: pointer;\n}\n.lil-gui input[type=checkbox]:checked:before {\n font-family: \"lil-gui\";\n content: \"✓\";\n font-size: var(--checkbox-size);\n line-height: var(--checkbox-size);\n}\n@media (hover: hover) {\n .lil-gui input[type=checkbox]:focus {\n box-shadow: inset 0 0 0 1px var(--focus-color);\n }\n}\n.lil-gui button {\n -webkit-tap-highlight-color: transparent;\n outline: none;\n cursor: pointer;\n font-family: var(--font-family);\n font-size: var(--font-size);\n color: var(--text-color);\n width: 100%;\n height: var(--widget-height);\n text-transform: none;\n background: var(--widget-color);\n border-radius: var(--widget-border-radius);\n border: 1px solid var(--widget-color);\n text-align: center;\n line-height: calc(var(--widget-height) - 4px);\n}\n@media (hover: hover) {\n .lil-gui button:hover {\n background: var(--hover-color);\n border-color: var(--hover-color);\n }\n .lil-gui button:focus {\n border-color: var(--focus-color);\n }\n}\n.lil-gui button:active {\n background: var(--focus-color);\n}\n\n@font-face {\n font-family: \"lil-gui\";\n src: url(\"data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==\") format(\"woff\");\n}\n.curve-editor {\n display: flex;\n flex-direction: column;\n gap: 5px;\n background-color: #303030;\n outline: 1px solid #000000;\n padding: 5px;\n width: 100%;\n}\n.curve-editor .button-medium {\n background-color: #545454;\n min-width: var(--widget-height);\n min-height: var(--widget-height);\n height: 100%;\n outline: 1px solid #3c3c3c;\n display: flex;\n justify-content: center;\n align-items: center;\n color: #fff;\n font-size: var(--input-font-size, 11px);\n}\n.curve-editor .button-medium.selected {\n background-color: #4772b3;\n pointer-events: none;\n}\n.curve-editor .button-medium:hover {\n background-color: #656565;\n cursor: default;\n}\n.curve-editor .curve-top {\n display: flex;\n width: 100%;\n}\n.curve-editor .curve-panel {\n width: 100%;\n height: 90px;\n outline: 1px solid #646464;\n}\n.curve-editor .curve-point-panel {\n display: flex;\n align-items: center;\n width: 100%;\n height: var(--widget-height);\n}\n.curve-editor .curve-point-panel input {\n background-color: #545454;\n height: 100%;\n width: 100%;\n color: #fff;\n border: 0;\n outline: 1px solid #3c3c3c;\n text-align: center;\n font-size: var(--input-font-size, 11px);\n}";
7
7
  n(css,{});
8
8
 
9
9
  class Controller {
@@ -178,7 +178,7 @@ class Controller {
178
178
  }
179
179
  return this;
180
180
  }
181
- needsUpdateDisplay() {
181
+ checkDisplay() {
182
182
  if (this.parent._closed) {
183
183
  return false;
184
184
  }
@@ -194,7 +194,7 @@ class Controller {
194
194
  // To prevent framerate loss, make sure the value has changed before updating the display.
195
195
  // Note: save() is used here instead of getValue() only because of ColorController. The !== operator
196
196
  // won't work for color objects or arrays, but ColorController.save() always returns a string.
197
- if (this.needsUpdateDisplay()) {
197
+ if (this.checkDisplay()) {
198
198
  this.updateDisplay();
199
199
  }
200
200
  }
@@ -216,7 +216,7 @@ class Controller {
216
216
  return this;
217
217
  }
218
218
  update() {
219
- if (this.needsUpdateDisplay()) {
219
+ if (this.checkDisplay()) {
220
220
  this.updateDisplay();
221
221
  }
222
222
  }
@@ -420,18 +420,6 @@ function getPrecision(value) {
420
420
  function hasDecimal(value) {
421
421
  return value % 1 !== 0;
422
422
  }
423
- let renderer;
424
- let material = new MeshBasicMaterial();
425
- function renderToCanvas(texture) {
426
- if (renderer === undefined) {
427
- renderer = new WebGLRenderer();
428
- }
429
- const image = texture.image;
430
- material.map = texture;
431
- renderer.setSize(image.width, image.height, false);
432
- Viewer.Blit(renderer, null, material);
433
- return renderer.domElement;
434
- }
435
423
 
436
424
  class NumberController extends Controller {
437
425
  min(min) {
@@ -1203,7 +1191,7 @@ class VectorController extends Controller {
1203
1191
  this._callOnChange();
1204
1192
  return this;
1205
1193
  }
1206
- needsUpdateDisplay() {
1194
+ checkDisplay() {
1207
1195
  return !this.parent._closed;
1208
1196
  }
1209
1197
  updateDisplay() {
@@ -1702,23 +1690,22 @@ class CurveController extends Controller {
1702
1690
  }
1703
1691
 
1704
1692
  class TextureController extends Controller {
1693
+ checkDisplay() {
1694
+ return this._autoRefresh || super.checkDisplay();
1695
+ }
1705
1696
  updateDisplay() {
1706
1697
  const canvas = this.$canvas;
1707
1698
  const context = canvas.getContext("2d");
1708
- if (context) {
1709
- context.clearRect(0, 0, canvas.width, canvas.height);
1710
- }
1711
1699
  let texture = this.getValue();
1712
1700
  if (texture) {
1713
1701
  let image = texture.image;
1714
1702
  if (image && image.width > 0) {
1715
1703
  this.$label.textContent = `${image.width}x${image.height}`;
1716
- canvas.title = texture.sourceFile;
1717
- let scale = canvas.width / image.width;
1718
- if (texture.isDataTexture || texture.isCompressedTexture) {
1719
- context.drawImage(renderToCanvas(texture), 0, 0, image.width * scale, image.height * scale);
1720
- } else if (image.depth) ; else {
1721
- context.drawImage(image, 0, 0, image.width * scale, image.height * scale);
1704
+ canvas.title = texture.sourceFile || "";
1705
+ canvas.height = canvas.width / image.width * image.height;
1706
+ if (this.getImage) {
1707
+ const w = 256, h = 256 / image.width * image.height;
1708
+ context.drawImage(this.getImage(texture, w, h), 0, 0, w * 1.5, h * 1.5, 0, 0, canvas.width, canvas.height); //why 1.5 ?
1722
1709
  }
1723
1710
  } else {
1724
1711
  canvas.title = texture.sourceFile + ' (error)';
@@ -1729,19 +1716,23 @@ class TextureController extends Controller {
1729
1716
  return this;
1730
1717
  }
1731
1718
  constructor(parent, object, property){
1732
- super(parent, object, property, "image");
1719
+ super(parent, object, property, "texture");
1720
+ this._autoRefresh = false;
1733
1721
  const group = this.$widget.appendChild(document.createElement("div"));
1734
- group.style.display = "flex";
1735
- group.style.flexDirection = "column";
1736
- group.style.width = "100%";
1722
+ group.classList.add("group");
1737
1723
  this.$canvas = group.appendChild(document.createElement("canvas"));
1738
- const label = document.createElement("div");
1739
- label.style.position = "absolute";
1740
- label.style.display = "flex";
1741
- label.style.backgroundColor = "black";
1742
- this.$label = group.appendChild(label);
1743
- group.onpointerover = (e)=>this.onpointerover && this.onpointerover(e);
1744
- group.onpointerout = (e)=>this.onpointerout && this.onpointerout(e);
1724
+ const label = this.$label = group.appendChild(document.createElement("div"));
1725
+ label.classList.add("label");
1726
+ let texture = this.getValue();
1727
+ if (texture && texture.image && texture.image.depth) {
1728
+ const block = group.appendChild(document.createElement("div"));
1729
+ block.classList.add("block");
1730
+ block.onclick = ()=>{
1731
+ this._autoRefresh = !this._autoRefresh;
1732
+ if (this._autoRefresh) block.classList.add("select");
1733
+ else block.classList.remove("select");
1734
+ };
1735
+ }
1745
1736
  }
1746
1737
  }
1747
1738
 
@@ -2268,6 +2259,12 @@ class ViewerHelper extends ObjectInstance {
2268
2259
  set environmentRotation(v) {
2269
2260
  this._scene.environmentRotation.copy(v);
2270
2261
  }
2262
+ get background() {
2263
+ return this._scene.background;
2264
+ }
2265
+ set background(v) {
2266
+ this._scene.background = v;
2267
+ }
2271
2268
  get backgroundRotation() {
2272
2269
  return this._scene.backgroundRotation;
2273
2270
  }
@@ -2326,7 +2323,9 @@ __decorate([
2326
2323
  })
2327
2324
  ], ViewerHelper.prototype, "backgroundBlurriness", null);
2328
2325
  __decorate([
2329
- property
2326
+ property({
2327
+ value: new Texture()
2328
+ })
2330
2329
  ], ViewerHelper.prototype, "environment", null);
2331
2330
  __decorate([
2332
2331
  property({
@@ -2340,23 +2339,23 @@ __decorate([
2340
2339
  step: 0.01
2341
2340
  })
2342
2341
  ], ViewerHelper.prototype, "environmentRotation", null);
2342
+ __decorate([
2343
+ property
2344
+ ], ViewerHelper.prototype, "background", null);
2343
2345
  __decorate([
2344
2346
  property({
2345
2347
  step: 0.01
2346
2348
  })
2347
2349
  ], ViewerHelper.prototype, "backgroundRotation", null);
2348
2350
  __decorate([
2349
- property({
2350
- min: 1,
2351
- max: 120,
2352
- step: 1
2353
- })
2351
+ property
2354
2352
  ], ViewerHelper.prototype, "targetFrameRate", null);
2355
2353
 
2356
2354
  class Inspector extends Mount {
2357
2355
  onLoad() {
2356
+ const { width, height } = this.viewer;
2358
2357
  this._scene = new Scene();
2359
- this._camera = new OrthographicCamera(0, window.innerWidth, window.innerHeight, 0, -1, 1);
2358
+ this._camera = new OrthographicCamera(0, width, height, 0, -1, 1);
2360
2359
  this._gui = new GUI({
2361
2360
  width: 310,
2362
2361
  title: "Inspector"
@@ -2365,7 +2364,6 @@ class Inspector extends Mount {
2365
2364
  this._gui.addFolder("Component").close().hide();
2366
2365
  this._gui.addFolder("Material").close().hide();
2367
2366
  this._gui.addFolder("Other").close().hide();
2368
- this._rect = this._gui.domElement.getBoundingClientRect();
2369
2367
  this._inspect(new ViewerHelper(this.viewer));
2370
2368
  this._addSprite();
2371
2369
  }
@@ -2384,9 +2382,17 @@ class Inspector extends Mount {
2384
2382
  this._camera.top = height;
2385
2383
  this._camera.bottom = 0;
2386
2384
  this._camera.updateProjectionMatrix();
2387
- this._rect = this._gui.domElement.getBoundingClientRect();
2388
2385
  }
2389
- render(dt) {
2386
+ _addSprite() {
2387
+ const viewer = this.viewer;
2388
+ this._sprite = viewer.add(Sprite, {
2389
+ parent: this._scene,
2390
+ scale: new Vector3(256, 256, 1),
2391
+ position: new Vector3(viewer.width / 2, viewer.height / 2),
2392
+ visible: false
2393
+ });
2394
+ }
2395
+ _renderScene() {
2390
2396
  const { renderer } = this.viewer;
2391
2397
  const autoClearDepth = renderer.autoClearDepth;
2392
2398
  const autoClearColor = renderer.autoClearColor;
@@ -2395,22 +2401,17 @@ class Inspector extends Mount {
2395
2401
  renderer.render(this._scene, this._camera);
2396
2402
  renderer.autoClearDepth = autoClearDepth;
2397
2403
  renderer.autoClearColor = autoClearColor;
2398
- }
2399
- _addSprite() {
2400
- const viewer = this.viewer;
2401
- this._tween = viewer.tween();
2402
- this._background = viewer.add(Sprite, {
2403
- parent: this._scene,
2404
- scale: new Vector3(258, 258, 1),
2405
- position: new Vector3(viewer.width / 2, viewer.height / 2)
2406
- });
2407
- this._background.material.opacity = 0;
2408
- this._sprite = viewer.add(Sprite, {
2409
- parent: this._scene,
2410
- scale: new Vector3(256, 256, 1),
2411
- position: new Vector3(viewer.width / 2, viewer.height / 2)
2412
- });
2413
- this._sprite.material.opacity = 0;
2404
+ return renderer.domElement;
2405
+ }
2406
+ _renderSprite(texture, w, h) {
2407
+ this._sprite.visible = true;
2408
+ this._sprite.scale.set(w, h, 1);
2409
+ this._sprite.position.set(w / 2, this._camera.top - h / 2, 0);
2410
+ this._sprite.material.map = texture;
2411
+ this._sprite.material.needsUpdate = true;
2412
+ const dom = this._renderScene();
2413
+ this._sprite.visible = false;
2414
+ return dom;
2414
2415
  }
2415
2416
  _updateFolders() {
2416
2417
  const refCntMap = this._refCntMap;
@@ -2419,8 +2420,8 @@ class Inspector extends Mount {
2419
2420
  if (refCntMap.get(v) === undefined) refCntMap.set(v, 1);
2420
2421
  };
2421
2422
  refCntMap.forEach((_, k, map)=>map.set(k, -1));
2422
- this.viewer.traverseComponents(setState);
2423
2423
  this.viewer.traverseMaterials(setState);
2424
+ this.viewer.traverseComponents(setState);
2424
2425
  refCntMap.forEach((v, k, map)=>{
2425
2426
  if (v === 1) {
2426
2427
  this._inspect(k);
@@ -2436,8 +2437,8 @@ class Inspector extends Mount {
2436
2437
  let props = PropertyManager._getMergedProperties(target.constructor);
2437
2438
  if (props) {
2438
2439
  const values = propsSort(props);
2439
- list.push(values);
2440
2440
  this._targetMap.set(values, target);
2441
+ list.push(values);
2441
2442
  }
2442
2443
  if (target instanceof ShaderMaterial) {
2443
2444
  props = Object.create(null);
@@ -2452,8 +2453,8 @@ class Inspector extends Mount {
2452
2453
  };
2453
2454
  });
2454
2455
  const values = propsSort(props);
2455
- list.push(values);
2456
2456
  this._targetMap.set(values, uniforms);
2457
+ list.push(values);
2457
2458
  }
2458
2459
  return list;
2459
2460
  }
@@ -2484,7 +2485,7 @@ class Inspector extends Mount {
2484
2485
  for (const props of list){
2485
2486
  target = this._targetMap.get(props) || source;
2486
2487
  for (const [k, prop] of props){
2487
- let value = target[k];
2488
+ let value = target[k] == null ? prop.value : target[k];
2488
2489
  if (value == null || prop.parent && target[prop.parent] == null) {
2489
2490
  continue;
2490
2491
  }
@@ -2495,46 +2496,31 @@ class Inspector extends Mount {
2495
2496
  if (PropertyManager._hasProperties(value.constructor)) {
2496
2497
  this._addGUI(folder, this._getPropertiesList(value), target, k);
2497
2498
  }
2498
- const type = typeof value;
2499
- let ins = null;
2500
- if (value.isColor) {
2501
- ins = folder.addColor(target, k);
2502
- } else if (value.isAnimationCurve) {
2503
- ins = folder.addCurve(target, k);
2504
- } else if (value.isVector2 || value.isVector3 || value.isVector4 || value.isEuler) {
2505
- ins = folder.addVector(target, k, prop.min, prop.max, prop.step);
2506
- } else if (value.isTexture) {
2507
- ins = folder.addTexture(target, k);
2508
- ins.onpointerover = ()=>{
2509
- const image = value.image;
2510
- const w = image.width * 256 / image.height, h = 256;
2511
- const x = this._rect.x - w / 2 - 10;
2512
- this._background.scale.set(w + 2, h + 2, 1);
2513
- this._background.position.x = x;
2514
- this._sprite.scale.set(w, h, 1);
2515
- this._sprite.position.x = x;
2516
- this._sprite.material.map = value;
2517
- this._sprite.material.needsUpdate = true;
2518
- this._tween.timeline(this._sprite.material).to({
2519
- opacity: 1
2520
- }, 0.3).start();
2521
- this._tween.timeline(this._background.material).to({
2522
- opacity: 1
2523
- }, 0.3).start();
2524
- };
2525
- ins.onpointerout = ()=>{
2526
- this._tween.timeline(this._background.material).to({
2527
- opacity: 0
2528
- }, 0.3).start();
2529
- this._tween.timeline(this._sprite.material).to({
2530
- opacity: 0
2531
- }, 0.3).start();
2532
- };
2533
- } else if (type === "number" || type === "boolean" || type === "string" || type === "function") {
2534
- ins = folder.add(target, k, prop.value || prop.min, prop.max, prop.step);
2535
- } else ;
2536
- if (ins && prop.name) {
2537
- ins.name(prop.name);
2499
+ if (Array.isArray(value)) {
2500
+ this._addGUI(folder, [
2501
+ value.map((_, i)=>[
2502
+ i.toString(),
2503
+ {}
2504
+ ])
2505
+ ], value, k);
2506
+ } else {
2507
+ const type = typeof value;
2508
+ let ins = null;
2509
+ if (value.isColor) {
2510
+ ins = folder.addColor(target, k);
2511
+ } else if (value.isAnimationCurve) {
2512
+ ins = folder.addCurve(target, k);
2513
+ } else if (value.isVector2 || value.isVector3 || value.isVector4 || value.isEuler) {
2514
+ ins = folder.addVector(target, k, prop.min, prop.max, prop.step);
2515
+ } else if (value.isTexture) {
2516
+ ins = folder.addTexture(target, k);
2517
+ ins.getImage = (texture, w, h)=>this._renderSprite(texture, w, h);
2518
+ } else if (type === "number" || type === "boolean" || type === "string" || type === "function") {
2519
+ ins = folder.add(target, k, prop.value || prop.min, prop.max, prop.step);
2520
+ } else ;
2521
+ if (ins && prop.name) {
2522
+ ins.name(prop.name);
2523
+ }
2538
2524
  }
2539
2525
  }
2540
2526
  }