import{definePlugin}from"../../core/extension";import{ModelMouseEvent}from"../../common/constant";import{CSS3DRenderer}from"three/examples/jsm/renderers/CSS3DRenderer";import{Scene}from"three";export default definePlugin("css3d",{setup(a,b){const c=b.container,d=new CSS3DRenderer,e=new Scene;d.setSize(c.clientWidth,c.clientHeight),d.domElement.style.position="absolute",d.domElement.style.top="0",d.domElement.style.left="0px";let f=a=>{d.domElement.addEventListener(a,a=>{a.stopPropagation(),a.preventDefault()})};[ModelMouseEvent.Blur,ModelMouseEvent.Hover,ModelMouseEvent.Mousemove,ModelMouseEvent.ContextMenu].forEach(a=>f(a)),c.append(d.domElement);const g=b.renderer.onResize((a,b)=>{d.setSize(a,b)});return{css3DRenderer:d,dispose:()=>{g(),d.domElement.remove()},update:()=>{d.render(e,b.camera)},add:a=>{e.add(a)}}},render(){this.update()},destroyed(){this.dispose()}});