@thatopen/components 2.0.0-alpha.0 → 2.0.0-alpha.1
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/core/Clipper/index.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +14 -14
- package/dist/namespace.d.ts +719 -555
- package/dist/navigation/OrthoPerspectiveCamera/index.d.ts +49 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/first-person-mode.d.ts +16 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/index.d.ts +5 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/orbit-mode.d.ts +16 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/plan-mode.d.ts +20 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/projections.d.ts +37 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/types.d.ts +27 -0
- package/dist/navigation/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -40,7 +40,7 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
|
|
|
40
40
|
* has to be `true` for this to apply.
|
|
41
41
|
*/
|
|
42
42
|
toleranceOrthogonalY: number;
|
|
43
|
-
|
|
43
|
+
list: T[];
|
|
44
44
|
protected PlaneType: new (...args: any) => SimplePlane | T;
|
|
45
45
|
/** The material used in all the clipping planes. */
|
|
46
46
|
protected _material: THREE.Material;
|
package/dist/index.cjs
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
`,extensions:{derivatives:!0}});this._grid=new L.Mesh(a,l),this._grid.frustumCulled=!1,t.scene.three.add(this._grid),this.setupEvents(!0)}get visible(){return this._grid.visible}set visible(s){s?this.world.scene.three.add(this._grid):this._grid.removeFromParent()}get material(){return this._grid.material}get fade(){return this._fade===3}set fade(s){this._fade=s?3:0,this.material.uniforms.uFade.value=this._fade}[Symbol.dispose](){throw new Error("Method not implemented.")}get(){return this._grid}dispose(){this.setupEvents(!1),this.components.get(_t).destroy(this._grid),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(s){if(!(this.world.camera instanceof De))return;const t=this.world.camera.controls;s?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}class fn extends st{constructor(){super(...arguments);f(this,"list",new Map);f(this,"onDisposed",new U);f(this,"config",{color:new L.Color(12303291),size1:1,size2:10,distance:500});f(this,"enabled",!0)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const e=new er(this.components,t,this.config);this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)})}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}}f(fn,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");const Vt=new C.Raycaster,it=new C.Vector3,yt=new C.Vector3,Q=new C.Quaternion,Qi={X:new C.Vector3(1,0,0),Y:new C.Vector3(0,1,0),Z:new C.Vector3(0,0,1)},Ws={type:"change"},qi={type:"mouseDown"},ji={type:"mouseUp",mode:null},Ki={type:"objectChange"};class sr extends C.Object3D{constructor(s,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const e=new cr;this._gizmo=e,this.add(e);const i=new lr;this._plane=i,this.add(i);const o=this;function n(m,O){let u=O;Object.defineProperty(o,m,{get:function(){return u!==void 0?u:O},set:function(R){u!==R&&(u=R,i[m]=R,e[m]=R,o.dispatchEvent({type:m+"-changed",value:R}),o.dispatchEvent(Ws))}}),o[m]=O,i[m]=O,e[m]=O}n("camera",s),n("object",void 0),n("enabled",!0),n("axis",null),n("mode","translate"),n("translationSnap",null),n("rotationSnap",null),n("scaleSnap",null),n("space","world"),n("size",1),n("dragging",!1),n("showX",!0),n("showY",!0),n("showZ",!0);const r=new C.Vector3,a=new C.Vector3,l=new C.Quaternion,E=new C.Quaternion,I=new C.Vector3,h=new C.Quaternion,d=new C.Vector3,p=new C.Vector3,F=new C.Vector3,A=0,T=new C.Vector3;n("worldPosition",r),n("worldPositionStart",a),n("worldQuaternion",l),n("worldQuaternionStart",E),n("cameraPosition",I),n("cameraQuaternion",h),n("pointStart",d),n("pointEnd",p),n("rotationAxis",F),n("rotationAngle",A),n("eye",T),this._offset=new C.Vector3,this._startNorm=new C.Vector3,this._endNorm=new C.Vector3,this._cameraScale=new C.Vector3,this._parentPosition=new C.Vector3,this._parentQuaternion=new C.Quaternion,this._parentQuaternionInv=new C.Quaternion,this._parentScale=new C.Vector3,this._worldScaleStart=new C.Vector3,this._worldQuaternionInv=new C.Quaternion,this._worldScale=new C.Vector3,this._positionStart=new C.Vector3,this._quaternionStart=new C.Quaternion,this._scaleStart=new C.Vector3,this._getPointer=ir.bind(this),this._onPointerDown=or.bind(this),this._onPointerHover=nr.bind(this),this._onPointerMove=rr.bind(this),this._onPointerUp=ar.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(s){if(this.object===void 0||this.dragging===!0)return;Vt.setFromCamera(s,this.camera);const t=Xs(this._gizmo.picker[this.mode],Vt);t?this.axis=t.object.name:this.axis=null}pointerDown(s){if(!(this.object===void 0||this.dragging===!0||s.button!==0)&&this.axis!==null){Vt.setFromCamera(s,this.camera);const t=Xs(this._plane,Vt,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,qi.mode=this.mode,this.dispatchEvent(qi)}}pointerMove(s){const t=this.axis,e=this.mode,i=this.object;let o=this.space;if(e==="scale"?o="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(o="world"),i===void 0||t===null||this.dragging===!1||s.button!==-1)return;Vt.setFromCamera(s,this.camera);const n=Xs(this._plane,Vt,!0);if(n){if(this.pointEnd.copy(n.point).sub(this.worldPositionStart),e==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),o==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(o==="local"&&(i.position.applyQuaternion(Q.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),o==="world"&&(i.parent&&i.position.add(it.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(it.setFromMatrixPosition(i.parent.matrixWorld))));else if(e==="scale"){if(t.search("XYZ")!==-1){let r=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(r*=-1),yt.set(r,r,r)}else it.copy(this.pointStart),yt.copy(this.pointEnd),it.applyQuaternion(this._worldQuaternionInv),yt.applyQuaternion(this._worldQuaternionInv),yt.divide(it),t.search("X")===-1&&(yt.x=1),t.search("Y")===-1&&(yt.y=1),t.search("Z")===-1&&(yt.z=1);i.scale.copy(this._scaleStart).multiply(yt),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(e==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const r=20/this.worldPosition.distanceTo(it.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(it.copy(this.rotationAxis).cross(this.eye))*r):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Qi[t]),it.copy(Qi[t]),o==="local"&&it.applyQuaternion(this.worldQuaternion),it.cross(this.eye),it.length()===0?a=!0:this.rotationAngle=this._offset.dot(it.normalize())*r),(t==="E"||a)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),o==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Ws),this.dispatchEvent(Ki)}}pointerUp(s){s.button===0&&(this.dragging&&this.axis!==null&&(ji.mode=this.mode,this.dispatchEvent(ji)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(s){s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose()})}attach(s){return this.object=s,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Ws),this.dispatchEvent(Ki),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Vt}getMode(){return this.mode}setMode(s){this.mode=s}setTranslationSnap(s){this.translationSnap=s}setRotationSnap(s){this.rotationSnap=s}setScaleSnap(s){this.scaleSnap=s}setSize(s){this.size=s}setSpace(s){this.space=s}}function ir(c){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:c.button};{const s=this.domElement.getBoundingClientRect();return{x:(c.clientX-s.left)/s.width*2-1,y:-(c.clientY-s.top)/s.height*2+1,button:c.button}}}function nr(c){if(this.enabled)switch(c.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(c));break}}function or(c){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(c.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(c)),this.pointerDown(this._getPointer(c)))}function rr(c){this.enabled&&this.pointerMove(this._getPointer(c))}function ar(c){this.enabled&&(this.domElement.releasePointerCapture(c.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(c)))}function Xs(c,s,t){const e=s.intersectObject(c,!0);for(let i=0;i<e.length;i++)if(e[i].object.visible||t)return e[i];return!1}const ss=new C.Euler,k=new C.Vector3(0,1,0),$i=new C.Vector3(0,0,0),Ji=new C.Matrix4,is=new C.Quaternion,as=new C.Quaternion,At=new C.Vector3,tn=new C.Matrix4,Ae=new C.Vector3(1,0,0),Gt=new C.Vector3(0,1,0),Oe=new C.Vector3(0,0,1),ns=new C.Vector3,Re=new C.Vector3,Fe=new C.Vector3;class cr extends C.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const s=new C.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new C.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=s.clone();e.opacity=.15;const i=t.clone();i.opacity=.5;const o=s.clone();o.color.setHex(16711680);const n=s.clone();n.color.setHex(65280);const r=s.clone();r.color.setHex(255);const a=s.clone();a.color.setHex(16711680),a.opacity=.5;const l=s.clone();l.color.setHex(65280),l.opacity=.5;const E=s.clone();E.color.setHex(255),E.opacity=.5;const I=s.clone();I.opacity=.25;const h=s.clone();h.color.setHex(16776960),h.opacity=.25,s.clone().color.setHex(16776960);const p=s.clone();p.color.setHex(7895160);const F=new C.CylinderGeometry(0,.04,.1,12);F.translate(0,.05,0);const A=new C.BoxGeometry(.08,.08,.08);A.translate(0,.04,0);const T=new C.BufferGeometry;T.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,0,0],3));const m=new C.CylinderGeometry(.0075,.0075,.5,3);m.translate(0,.25,0);function O(v,H){const q=new C.TorusGeometry(v,.0075,3,64,H*Math.PI*2);return q.rotateY(Math.PI/2),q.rotateX(Math.PI/2),q}function u(){const v=new C.BufferGeometry;return v.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,1,1],3)),v}const R={X:[[new C.Mesh(F,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(F,o),[-.5,0,0],[0,0,Math.PI/2]],[new C.Mesh(m,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new C.Mesh(F,n),[0,.5,0]],[new C.Mesh(F,n),[0,-.5,0],[Math.PI,0,0]],[new C.Mesh(m,n)]],Z:[[new C.Mesh(F,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(F,r),[0,0,-.5],[-Math.PI/2,0,0]],[new C.Mesh(m,r),null,[Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.1,0),I.clone()),[0,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),E.clone()),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},S={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.2,0),e)]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]]},g={START:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new C.Line(u(),i),null,null,null,"helper"]],X:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(T,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(T,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},_={XYZE:[[new C.Mesh(O(.5,1),p),null,[0,Math.PI/2,0]]],X:[[new C.Mesh(O(.5,.5),o)]],Y:[[new C.Mesh(O(.5,.5),n),null,[0,0,-Math.PI/2]]],Z:[[new C.Mesh(O(.5,.5),r),null,[0,Math.PI/2,0]]],E:[[new C.Mesh(O(.75,1),h),null,[0,Math.PI/2,0]]]},N={AXIS:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},P={XYZE:[[new C.Mesh(new C.SphereGeometry(.25,10,8),e)]],X:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[Math.PI/2,0,0]]],Z:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,0,-Math.PI/2]]],E:[[new C.Mesh(new C.TorusGeometry(.75,.1,2,24),e)]]},w={X:[[new C.Mesh(A,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(m,o),[0,0,0],[0,0,-Math.PI/2]],[new C.Mesh(A,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(A,n),[0,.5,0]],[new C.Mesh(m,n)],[new C.Mesh(A,n),[0,-.5,0],[0,0,Math.PI]]],Z:[[new C.Mesh(A,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(m,r),[0,0,0],[Math.PI/2,0,0]],[new C.Mesh(A,r),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),E),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.1,.1,.1),I.clone())]]},M={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.2),e),[0,0,0]]]},D={X:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(T,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(T,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function x(v){const H=new C.Object3D;for(const q in v)for(let tt=v[q].length;tt--;){const Z=v[q][tt][0].clone(),Ut=v[q][tt][1],xt=v[q][tt][2],bt=v[q][tt][3],Ue=v[q][tt][4];Z.name=q,Z.tag=Ue,Ut&&Z.position.set(Ut[0],Ut[1],Ut[2]),xt&&Z.rotation.set(xt[0],xt[1],xt[2]),bt&&Z.scale.set(bt[0],bt[1],bt[2]),Z.updateMatrix();const ae=Z.geometry.clone();ae.applyMatrix4(Z.matrix),Z.geometry=ae,Z.renderOrder=1/0,Z.position.set(0,0,0),Z.rotation.set(0,0,0),Z.scale.set(1,1,1),H.add(Z)}return H}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=x(R)),this.add(this.gizmo.rotate=x(_)),this.add(this.gizmo.scale=x(w)),this.add(this.picker.translate=x(S)),this.add(this.picker.rotate=x(P)),this.add(this.picker.scale=x(M)),this.add(this.helper.translate=x(g)),this.add(this.helper.rotate=x(N)),this.add(this.helper.scale=x(D)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(s){const e=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:as;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let o=0;o<i.length;o++){const n=i[o];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let r;if(this.camera.isOrthographicCamera?r=(this.camera.top-this.camera.bottom)/this.camera.zoom:r=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(r*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(Q.setFromEuler(ss.set(0,0,0)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Ae).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(Q.setFromEuler(ss.set(0,0,Math.PI/2)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Gt).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(Q.setFromEuler(ss.set(0,Math.PI/2,0)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Oe).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(Q.setFromEuler(ss.set(0,Math.PI/2,0)),k.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(Ji.lookAt($i,k,Gt)),n.quaternion.multiply(Q),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),it.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),it.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(it),n.visible=this.dragging):(n.quaternion.copy(e),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(e),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(k.copy(Ae).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(k.copy(Gt).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(k.copy(Oe).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(k.copy(Oe).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(k.copy(Ae).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(k.copy(Gt).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(is.copy(e),k.copy(this.eye).applyQuaternion(Q.copy(e).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(Ji.lookAt(this.eye,$i,Gt)),n.name==="X"&&(Q.setFromAxisAngle(Ae,Math.atan2(-k.y,k.z)),Q.multiplyQuaternions(is,Q),n.quaternion.copy(Q)),n.name==="Y"&&(Q.setFromAxisAngle(Gt,Math.atan2(k.x,k.z)),Q.multiplyQuaternions(is,Q),n.quaternion.copy(Q)),n.name==="Z"&&(Q.setFromAxisAngle(Oe,Math.atan2(k.y,k.x)),Q.multiplyQuaternions(is,Q),n.quaternion.copy(Q))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some(function(a){return n.name===a}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(s)}}class lr extends C.Mesh{constructor(){super(new C.PlaneGeometry(1e5,1e5,2,2),new C.MeshBasicMaterial({visible:!1,wireframe:!0,side:C.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(s){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),ns.copy(Ae).applyQuaternion(t==="local"?this.worldQuaternion:as),Re.copy(Gt).applyQuaternion(t==="local"?this.worldQuaternion:as),Fe.copy(Oe).applyQuaternion(t==="local"?this.worldQuaternion:as),k.copy(Re),this.mode){case"translate":case"scale":switch(this.axis){case"X":k.copy(this.eye).cross(ns),At.copy(ns).cross(k);break;case"Y":k.copy(this.eye).cross(Re),At.copy(Re).cross(k);break;case"Z":k.copy(this.eye).cross(Fe),At.copy(Fe).cross(k);break;case"XY":At.copy(Fe);break;case"YZ":At.copy(ns);break;case"XZ":k.copy(Fe),At.copy(Re);break;case"XYZ":case"E":At.set(0,0,0);break}break;case"rotate":default:At.set(0,0,0)}At.length()===0?this.quaternion.copy(this.cameraQuaternion):(tn.lookAt(it.set(0,0,0),At,k),this.quaternion.setFromRotationMatrix(tn)),super.updateMatrixWorld(s)}}class As{constructor(s,t,e,i,o,n=5,r=!0){f(this,"onDraggingStarted",new U);f(this,"onDraggingEnded",new U);f(this,"onDisposed",new U);f(this,"normal");f(this,"origin");f(this,"three",new L.Plane);f(this,"_helper");f(this,"_visible",!0);f(this,"_enabled",!0);f(this,"components");f(this,"world");f(this,"_controlsActive",!1);f(this,"_arrowBoundBox",new L.Mesh);f(this,"_planeMesh");f(this,"_controls");f(this,"_hiddenMaterial",new L.MeshBasicMaterial({visible:!1}));f(this,"update",async()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});f(this,"changeDrag",s=>{this._visible=!s.value,this.preventCameraMovement(),this.notifyDraggingChanged(s)});if(this.components=s,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=e,t.renderer.setPlane(!0,this.three),this._planeMesh=As.newPlaneMesh(n,o),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,e),r&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(s){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=s,this.world.renderer.setPlane(s,this.three)}get visible(){return this._visible}set visible(s){this._visible=s,this._controls.visible=s,this._helper.visible=s,this.toggleControls(s)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(s){this._planeMesh.material=s}get size(){return this._planeMesh.scale.x}set size(s){this._planeMesh.scale.set(s,s,s)}get helper(){return this._helper}async setFromNormalAndCoplanarPoint(s,t){this.reset(),this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),await this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const s=new L.Vector3(1,0,0),t=new L.Vector3;this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(s){if(s){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=s}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const s=this.world.camera.three,t=this.world.renderer.three.domElement,e=new sr(s,t);return this.initializeControls(e),this.world.scene.three.add(e),e}initializeControls(s){s.attach(this._helper),s.showX=!1,s.showY=!1,s.setSpace("local"),this.createArrowBoundingBox(),s.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new L.CylinderGeometry(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(s){s.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const s=new L.Object3D;return s.lookAt(this.normal),s.position.copy(this.origin),this._planeMesh.position.z+=.01,s.add(this._planeMesh),this.world.scene.three.add(s),s}static newPlaneMesh(s,t){const e=new L.PlaneGeometry(1),i=new L.Mesh(e,t);return i.scale.set(s,s,s),i}}const _e=class _e extends st{constructor(t){super(t);f(this,"onAfterCreate",new U);f(this,"onAfterDelete",new U);f(this,"onBeforeDrag",new U);f(this,"onAfterDrag",new U);f(this,"onBeforeCreate",new U);f(this,"onBeforeCancel",new U);f(this,"onAfterCancel",new U);f(this,"onBeforeDelete",new U);f(this,"onDisposed",new U);f(this,"orthogonalY",!1);f(this,"toleranceOrthogonalY",.7);f(this,"planes",[]);f(this,"PlaneType");f(this,"_material",new L.MeshBasicMaterial({color:16776960,side:L.DoubleSide,transparent:!0,opacity:.2}));f(this,"_size",5);f(this,"_enabled",!1);f(this,"_visible",!1);f(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()});f(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()});this.components.add(_e.uuid,this),this.PlaneType=As}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const e of this.planes)e.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const e of this.planes)e.visible=t}get material(){return this._material}set material(t){this._material=t;for(const e of this.planes)e.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const e of this.planes)e.size=t}endCreation(){}cancelCreation(){}dispose(){this._enabled=!1;for(const t of this.planes)t.dispose();this.planes.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(_e.uuid),this.onDisposed.reset()}create(t){if(!this.enabled)return;const o=this.components.get(Me).get(t).castRay();o&&this.createPlaneFromIntersection(t,o)}createFromNormalAndCoplanarPoint(t,e,i){const o=this.newPlane(t,i,e);return this.updateMaterialsAndPlanes(),o}delete(t,e){this.enabled&&(e||(e=this.pickPlane(t)),e&&this.deletePlane(e))}deleteAll(){for(;this.planes.length>0;){const t=this.planes[0];this.delete(t.world,t)}}deletePlane(t){const e=this.planes.indexOf(t);if(e!==-1){if(this.planes.splice(e,1),!t.world.renderer)throw new Error("Renderer not found for this plane's world!");t.world.renderer.setPlane(!1,t.three),t.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(t)}}pickPlane(t){const i=this.components.get(Me).get(t),o=this.getAllPlaneMeshes(),n=i.castRay(o);if(n){const r=n.object;return this.planes.find(a=>a.meshes.includes(r))}}getAllPlaneMeshes(){const t=[];for(const e of this.planes)t.push(...e.meshes);return t}createPlaneFromIntersection(t,e){var a;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=e.point.distanceTo(new L.Vector3(0,0,0)),o=(a=e.face)==null?void 0:a.normal;if(!i||!o)return;const n=this.getWorldNormal(e,o),r=this.newPlane(t,e.point,n.negate());t.renderer.setPlane(!0,r.three),this.updateMaterialsAndPlanes()}getWorldNormal(t,e){const i=t.object;let o=t.object.matrixWorld.clone();if(i instanceof L.InstancedMesh&&t.instanceId!==void 0){const l=new L.Matrix4;i.getMatrixAt(t.instanceId,l),o=l.multiply(o)}const r=new L.Matrix3().getNormalMatrix(o),a=e.clone().applyMatrix3(r).normalize();return this.normalizePlaneDirectionY(a),a}normalizePlaneDirectionY(t){this.orthogonalY&&(t.y>this.toleranceOrthogonalY&&(t.x=0,t.y=1,t.z=0),t.y<-this.toleranceOrthogonalY&&(t.x=0,t.y=-1,t.z=0))}newPlane(t,e,i){const o=this.newPlaneInstance(t,e,i);return o.onDraggingStarted.add(this._onStartDragging),o.onDraggingEnded.add(this._onEndDragging),this.planes.push(o),this.onAfterCreate.trigger(o),o}newPlaneInstance(t,e,i){return new this.PlaneType(this.components,t,e,i,this._material)}updateMaterialsAndPlanes(){const t=this.components.get(hs);for(const[e,i]of t.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:o}=i.renderer;for(const n of i.meshes)if(Array.isArray(n.material))for(const r of n.material)r.clippingPlanes=o;else n.material.clippingPlanes=o}}};f(_e,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let ii=_e;const Ne=class Ne extends st{constructor(t){super(t);f(this,"enabled",!0);f(this,"_originalBackground",new Map);f(this,"onDisposed",new U);f(this,"list",{});f(this,"_originals",{});this.components.add(Ne.uuid,this)}set(t,e=Object.keys(this.list)){for(const i of e){const{material:o,meshes:n}=this.list[i];for(const r of n)if(t)this._originals[r.uuid]||(this._originals[r.uuid]={material:r.material}),r instanceof L.InstancedMesh&&r.instanceColor&&(this._originals[r.uuid].instances=r.instanceColor,r.instanceColor=null),r.material=o;else{if(!this._originals[r.uuid])continue;r.material=this._originals[r.uuid].material;const a=this._originals[r.uuid].instances;r instanceof L.InstancedMesh&&a&&(r.instanceColor=a)}}}dispose(){for(const t in this.list){const{material:e}=this.list[t];e.dispose()}this.list={},this._originals={},this.onDisposed.trigger(Ne.uuid),this.onDisposed.reset(),this._originalBackground.clear()}setBackgroundColor(t,e){const i=e.scene.three;i instanceof L.Scene&&(this._originalBackground.has(e.uuid)||this._originalBackground.set(e.uuid,i.background),this._originalBackground&&(i.background=t))}resetBackgroundColor(t){const e=t.scene.three;if(!(e instanceof L.Scene))return;const i=this._originalBackground.get(t.uuid);i&&(e.background=i)}addMaterial(t,e){if(this.list[t])throw new Error("This ID already exists!");this.list[t]={material:e,meshes:new Set}}addMeshes(t,e){if(!this.list[t])throw new Error("This ID doesn't exists!");for(const i of e)this.list[t].meshes.add(i)}removeMeshes(t,e){if(!this.list[t])throw new Error("This ID doesn't exists!");for(const i of e)this.list[t].meshes.delete(i)}};f(Ne,"uuid","24989d27-fa2f-4797-8b08-35918f74e502");let ni=Ne;function hr(c,s,t,e){return new Promise((i,o)=>{function n(){const r=c.clientWaitSync(s,t,0);if(r===c.WAIT_FAILED){o();return}if(r===c.TIMEOUT_EXPIRED){setTimeout(n,e);return}i()}n()})}async function Er(c,s,t,e,i,o,n){const r=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),await hr(c,r,0,10),c.deleteSync(r),c.bindBuffer(s,t),c.getBufferSubData(s,e,i,o,n),c.bindBuffer(s,null)}async function Cn(c,s,t,e,i,o,n,r){const a=c.createBuffer();return c.bindBuffer(c.PIXEL_PACK_BUFFER,a),c.bufferData(c.PIXEL_PACK_BUFFER,r.byteLength,c.STREAM_READ),c.readPixels(s,t,e,i,o,n,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null),await Er(c,c.PIXEL_PACK_BUFFER,a,0,r),c.deleteBuffer(a),r}class pn{constructor(s,t,e){f(this,"onDisposed",new U);f(this,"onViewUpdated",new U);f(this,"enabled",!0);f(this,"needsUpdate",!1);f(this,"renderDebugFrame",!1);f(this,"components");f(this,"world");f(this,"renderer");f(this,"autoUpdate",!0);f(this,"updateInterval",1e3);f(this,"worker");f(this,"scene",new L.Scene);f(this,"_width",512);f(this,"_height",512);f(this,"_availableColor",1);f(this,"renderTarget");f(this,"bufferSize");f(this,"_buffer");f(this,"updateVisibility",async s=>{if(!this.enabled||!this.needsUpdate&&!s)return;const t=this.world.camera.three;t.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const e=this.renderer.getContext();await Cn(e,0,0,this._width,this._height,e.RGBA,e.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.applySettings(e),this.world=t,this.renderer=new L.WebGLRenderer,this.renderTarget=new L.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const i=`
|
|
71
|
+
`,extensions:{derivatives:!0}});this._grid=new L.Mesh(a,l),this._grid.frustumCulled=!1,t.scene.three.add(this._grid),this.setupEvents(!0)}get visible(){return this._grid.visible}set visible(s){s?this.world.scene.three.add(this._grid):this._grid.removeFromParent()}get material(){return this._grid.material}get fade(){return this._fade===3}set fade(s){this._fade=s?3:0,this.material.uniforms.uFade.value=this._fade}[Symbol.dispose](){throw new Error("Method not implemented.")}get(){return this._grid}dispose(){this.setupEvents(!1),this.components.get(_t).destroy(this._grid),this.onDisposed.trigger(),this.onDisposed.reset(),this.world=null,this.components=null}setupEvents(s){if(!(this.world.camera instanceof De))return;const t=this.world.camera.controls;s?t.addEventListener("update",this.updateZoom):t.removeEventListener("update",this.updateZoom)}}class fn extends st{constructor(){super(...arguments);f(this,"list",new Map);f(this,"onDisposed",new U);f(this,"config",{color:new L.Color(12303291),size1:1,size2:10,distance:500});f(this,"enabled",!0)}create(t){if(this.list.has(t.uuid))throw new Error("This world already has a grid!");const e=new er(this.components,t,this.config);this.list.set(t.uuid,e),t.onDisposed.add(()=>{this.delete(t)})}delete(t){const e=this.list.get(t.uuid);e&&e.dispose(),this.list.delete(t.uuid)}dispose(){for(const[t,e]of this.list)e.dispose();this.list.clear(),this.onDisposed.trigger()}}f(fn,"uuid","d1e814d5-b81c-4452-87a2-f039375e0489");const Vt=new C.Raycaster,it=new C.Vector3,yt=new C.Vector3,Q=new C.Quaternion,Qi={X:new C.Vector3(1,0,0),Y:new C.Vector3(0,1,0),Z:new C.Vector3(0,0,1)},Ws={type:"change"},qi={type:"mouseDown"},ji={type:"mouseUp",mode:null},Ki={type:"objectChange"};class sr extends C.Object3D{constructor(s,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const e=new cr;this._gizmo=e,this.add(e);const i=new lr;this._plane=i,this.add(i);const o=this;function n(m,O){let u=O;Object.defineProperty(o,m,{get:function(){return u!==void 0?u:O},set:function(R){u!==R&&(u=R,i[m]=R,e[m]=R,o.dispatchEvent({type:m+"-changed",value:R}),o.dispatchEvent(Ws))}}),o[m]=O,i[m]=O,e[m]=O}n("camera",s),n("object",void 0),n("enabled",!0),n("axis",null),n("mode","translate"),n("translationSnap",null),n("rotationSnap",null),n("scaleSnap",null),n("space","world"),n("size",1),n("dragging",!1),n("showX",!0),n("showY",!0),n("showZ",!0);const r=new C.Vector3,a=new C.Vector3,l=new C.Quaternion,E=new C.Quaternion,I=new C.Vector3,h=new C.Quaternion,d=new C.Vector3,p=new C.Vector3,F=new C.Vector3,A=0,T=new C.Vector3;n("worldPosition",r),n("worldPositionStart",a),n("worldQuaternion",l),n("worldQuaternionStart",E),n("cameraPosition",I),n("cameraQuaternion",h),n("pointStart",d),n("pointEnd",p),n("rotationAxis",F),n("rotationAngle",A),n("eye",T),this._offset=new C.Vector3,this._startNorm=new C.Vector3,this._endNorm=new C.Vector3,this._cameraScale=new C.Vector3,this._parentPosition=new C.Vector3,this._parentQuaternion=new C.Quaternion,this._parentQuaternionInv=new C.Quaternion,this._parentScale=new C.Vector3,this._worldScaleStart=new C.Vector3,this._worldQuaternionInv=new C.Quaternion,this._worldScale=new C.Vector3,this._positionStart=new C.Vector3,this._quaternionStart=new C.Quaternion,this._scaleStart=new C.Vector3,this._getPointer=ir.bind(this),this._onPointerDown=or.bind(this),this._onPointerHover=nr.bind(this),this._onPointerMove=rr.bind(this),this._onPointerUp=ar.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(s){if(this.object===void 0||this.dragging===!0)return;Vt.setFromCamera(s,this.camera);const t=Xs(this._gizmo.picker[this.mode],Vt);t?this.axis=t.object.name:this.axis=null}pointerDown(s){if(!(this.object===void 0||this.dragging===!0||s.button!==0)&&this.axis!==null){Vt.setFromCamera(s,this.camera);const t=Xs(this._plane,Vt,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,qi.mode=this.mode,this.dispatchEvent(qi)}}pointerMove(s){const t=this.axis,e=this.mode,i=this.object;let o=this.space;if(e==="scale"?o="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(o="world"),i===void 0||t===null||this.dragging===!1||s.button!==-1)return;Vt.setFromCamera(s,this.camera);const n=Xs(this._plane,Vt,!0);if(n){if(this.pointEnd.copy(n.point).sub(this.worldPositionStart),e==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),o==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(o==="local"&&(i.position.applyQuaternion(Q.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),o==="world"&&(i.parent&&i.position.add(it.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(it.setFromMatrixPosition(i.parent.matrixWorld))));else if(e==="scale"){if(t.search("XYZ")!==-1){let r=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(r*=-1),yt.set(r,r,r)}else it.copy(this.pointStart),yt.copy(this.pointEnd),it.applyQuaternion(this._worldQuaternionInv),yt.applyQuaternion(this._worldQuaternionInv),yt.divide(it),t.search("X")===-1&&(yt.x=1),t.search("Y")===-1&&(yt.y=1),t.search("Z")===-1&&(yt.z=1);i.scale.copy(this._scaleStart).multiply(yt),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(e==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const r=20/this.worldPosition.distanceTo(it.setFromMatrixPosition(this.camera.matrixWorld));let a=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(it.copy(this.rotationAxis).cross(this.eye))*r):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Qi[t]),it.copy(Qi[t]),o==="local"&&it.applyQuaternion(this.worldQuaternion),it.cross(this.eye),it.length()===0?a=!0:this.rotationAngle=this._offset.dot(it.normalize())*r),(t==="E"||a)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),o==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(Q.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Ws),this.dispatchEvent(Ki)}}pointerUp(s){s.button===0&&(this.dragging&&this.axis!==null&&(ji.mode=this.mode,this.dispatchEvent(ji)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(s){s.geometry&&s.geometry.dispose(),s.material&&s.material.dispose()})}attach(s){return this.object=s,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Ws),this.dispatchEvent(Ki),this.pointStart.copy(this.pointEnd))}getRaycaster(){return Vt}getMode(){return this.mode}setMode(s){this.mode=s}setTranslationSnap(s){this.translationSnap=s}setRotationSnap(s){this.rotationSnap=s}setScaleSnap(s){this.scaleSnap=s}setSize(s){this.size=s}setSpace(s){this.space=s}}function ir(c){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:c.button};{const s=this.domElement.getBoundingClientRect();return{x:(c.clientX-s.left)/s.width*2-1,y:-(c.clientY-s.top)/s.height*2+1,button:c.button}}}function nr(c){if(this.enabled)switch(c.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(c));break}}function or(c){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(c.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(c)),this.pointerDown(this._getPointer(c)))}function rr(c){this.enabled&&this.pointerMove(this._getPointer(c))}function ar(c){this.enabled&&(this.domElement.releasePointerCapture(c.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(c)))}function Xs(c,s,t){const e=s.intersectObject(c,!0);for(let i=0;i<e.length;i++)if(e[i].object.visible||t)return e[i];return!1}const ss=new C.Euler,k=new C.Vector3(0,1,0),$i=new C.Vector3(0,0,0),Ji=new C.Matrix4,is=new C.Quaternion,as=new C.Quaternion,At=new C.Vector3,tn=new C.Matrix4,Ae=new C.Vector3(1,0,0),Gt=new C.Vector3(0,1,0),Oe=new C.Vector3(0,0,1),ns=new C.Vector3,Re=new C.Vector3,Fe=new C.Vector3;class cr extends C.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const s=new C.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new C.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=s.clone();e.opacity=.15;const i=t.clone();i.opacity=.5;const o=s.clone();o.color.setHex(16711680);const n=s.clone();n.color.setHex(65280);const r=s.clone();r.color.setHex(255);const a=s.clone();a.color.setHex(16711680),a.opacity=.5;const l=s.clone();l.color.setHex(65280),l.opacity=.5;const E=s.clone();E.color.setHex(255),E.opacity=.5;const I=s.clone();I.opacity=.25;const h=s.clone();h.color.setHex(16776960),h.opacity=.25,s.clone().color.setHex(16776960);const p=s.clone();p.color.setHex(7895160);const F=new C.CylinderGeometry(0,.04,.1,12);F.translate(0,.05,0);const A=new C.BoxGeometry(.08,.08,.08);A.translate(0,.04,0);const T=new C.BufferGeometry;T.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,0,0],3));const m=new C.CylinderGeometry(.0075,.0075,.5,3);m.translate(0,.25,0);function O(v,H){const q=new C.TorusGeometry(v,.0075,3,64,H*Math.PI*2);return q.rotateY(Math.PI/2),q.rotateX(Math.PI/2),q}function u(){const v=new C.BufferGeometry;return v.setAttribute("position",new C.Float32BufferAttribute([0,0,0,1,1,1],3)),v}const R={X:[[new C.Mesh(F,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(F,o),[-.5,0,0],[0,0,Math.PI/2]],[new C.Mesh(m,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new C.Mesh(F,n),[0,.5,0]],[new C.Mesh(F,n),[0,-.5,0],[Math.PI,0,0]],[new C.Mesh(m,n)]],Z:[[new C.Mesh(F,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(F,r),[0,0,-.5],[-Math.PI/2,0,0]],[new C.Mesh(m,r),null,[Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.1,0),I.clone()),[0,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),E.clone()),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),l.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},S={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.OctahedronGeometry(.2,0),e)]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]]},g={START:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new C.Mesh(new C.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new C.Line(u(),i),null,null,null,"helper"]],X:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(T,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(T,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},_={XYZE:[[new C.Mesh(O(.5,1),p),null,[0,Math.PI/2,0]]],X:[[new C.Mesh(O(.5,.5),o)]],Y:[[new C.Mesh(O(.5,.5),n),null,[0,0,-Math.PI/2]]],Z:[[new C.Mesh(O(.5,.5),r),null,[0,Math.PI/2,0]]],E:[[new C.Mesh(O(.75,1),h),null,[0,Math.PI/2,0]]]},N={AXIS:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},P={XYZE:[[new C.Mesh(new C.SphereGeometry(.25,10,8),e)]],X:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[Math.PI/2,0,0]]],Z:[[new C.Mesh(new C.TorusGeometry(.5,.1,4,24),e),[0,0,0],[0,0,-Math.PI/2]]],E:[[new C.Mesh(new C.TorusGeometry(.75,.1,2,24),e)]]},w={X:[[new C.Mesh(A,o),[.5,0,0],[0,0,-Math.PI/2]],[new C.Mesh(m,o),[0,0,0],[0,0,-Math.PI/2]],[new C.Mesh(A,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(A,n),[0,.5,0]],[new C.Mesh(m,n)],[new C.Mesh(A,n),[0,-.5,0],[0,0,Math.PI]]],Z:[[new C.Mesh(A,r),[0,0,.5],[Math.PI/2,0,0]],[new C.Mesh(m,r),[0,0,0],[Math.PI/2,0,0]],[new C.Mesh(A,r),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),E),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.15,.15,.01),l),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.1,.1,.1),I.clone())]]},M={X:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[.3,0,0],[0,0,-Math.PI/2]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,.3,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,-.3,0],[0,0,Math.PI]]],Z:[[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,.3],[Math.PI/2,0,0]],[new C.Mesh(new C.CylinderGeometry(.2,0,.6,4),e),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,.15,0]]],YZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.01),e),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new C.Mesh(new C.BoxGeometry(.2,.2,.2),e),[0,0,0]]]},D={X:[[new C.Line(T,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new C.Line(T,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new C.Line(T,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function x(v){const H=new C.Object3D;for(const q in v)for(let tt=v[q].length;tt--;){const Z=v[q][tt][0].clone(),Ut=v[q][tt][1],xt=v[q][tt][2],bt=v[q][tt][3],Ue=v[q][tt][4];Z.name=q,Z.tag=Ue,Ut&&Z.position.set(Ut[0],Ut[1],Ut[2]),xt&&Z.rotation.set(xt[0],xt[1],xt[2]),bt&&Z.scale.set(bt[0],bt[1],bt[2]),Z.updateMatrix();const ae=Z.geometry.clone();ae.applyMatrix4(Z.matrix),Z.geometry=ae,Z.renderOrder=1/0,Z.position.set(0,0,0),Z.rotation.set(0,0,0),Z.scale.set(1,1,1),H.add(Z)}return H}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=x(R)),this.add(this.gizmo.rotate=x(_)),this.add(this.gizmo.scale=x(w)),this.add(this.picker.translate=x(S)),this.add(this.picker.rotate=x(P)),this.add(this.picker.scale=x(M)),this.add(this.helper.translate=x(g)),this.add(this.helper.rotate=x(N)),this.add(this.helper.scale=x(D)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(s){const e=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:as;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let o=0;o<i.length;o++){const n=i[o];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let r;if(this.camera.isOrthographicCamera?r=(this.camera.top-this.camera.bottom)/this.camera.zoom:r=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(r*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(Q.setFromEuler(ss.set(0,0,0)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Ae).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(Q.setFromEuler(ss.set(0,0,Math.PI/2)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Gt).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(Q.setFromEuler(ss.set(0,Math.PI/2,0)),n.quaternion.copy(e).multiply(Q),Math.abs(k.copy(Oe).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(Q.setFromEuler(ss.set(0,Math.PI/2,0)),k.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(Ji.lookAt($i,k,Gt)),n.quaternion.multiply(Q),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),it.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),it.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(it),n.visible=this.dragging):(n.quaternion.copy(e),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(e),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(k.copy(Ae).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(k.copy(Gt).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(k.copy(Oe).applyQuaternion(e).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(k.copy(Oe).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(k.copy(Ae).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(k.copy(Gt).applyQuaternion(e).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(is.copy(e),k.copy(this.eye).applyQuaternion(Q.copy(e).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(Ji.lookAt(this.eye,$i,Gt)),n.name==="X"&&(Q.setFromAxisAngle(Ae,Math.atan2(-k.y,k.z)),Q.multiplyQuaternions(is,Q),n.quaternion.copy(Q)),n.name==="Y"&&(Q.setFromAxisAngle(Gt,Math.atan2(k.x,k.z)),Q.multiplyQuaternions(is,Q),n.quaternion.copy(Q)),n.name==="Z"&&(Q.setFromAxisAngle(Oe,Math.atan2(k.y,k.x)),Q.multiplyQuaternions(is,Q),n.quaternion.copy(Q))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some(function(a){return n.name===a}))&&(n.material.color.setHex(16776960),n.material.opacity=1)}super.updateMatrixWorld(s)}}class lr extends C.Mesh{constructor(){super(new C.PlaneGeometry(1e5,1e5,2,2),new C.MeshBasicMaterial({visible:!1,wireframe:!0,side:C.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(s){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),ns.copy(Ae).applyQuaternion(t==="local"?this.worldQuaternion:as),Re.copy(Gt).applyQuaternion(t==="local"?this.worldQuaternion:as),Fe.copy(Oe).applyQuaternion(t==="local"?this.worldQuaternion:as),k.copy(Re),this.mode){case"translate":case"scale":switch(this.axis){case"X":k.copy(this.eye).cross(ns),At.copy(ns).cross(k);break;case"Y":k.copy(this.eye).cross(Re),At.copy(Re).cross(k);break;case"Z":k.copy(this.eye).cross(Fe),At.copy(Fe).cross(k);break;case"XY":At.copy(Fe);break;case"YZ":At.copy(ns);break;case"XZ":k.copy(Fe),At.copy(Re);break;case"XYZ":case"E":At.set(0,0,0);break}break;case"rotate":default:At.set(0,0,0)}At.length()===0?this.quaternion.copy(this.cameraQuaternion):(tn.lookAt(it.set(0,0,0),At,k),this.quaternion.setFromRotationMatrix(tn)),super.updateMatrixWorld(s)}}class As{constructor(s,t,e,i,o,n=5,r=!0){f(this,"onDraggingStarted",new U);f(this,"onDraggingEnded",new U);f(this,"onDisposed",new U);f(this,"normal");f(this,"origin");f(this,"three",new L.Plane);f(this,"_helper");f(this,"_visible",!0);f(this,"_enabled",!0);f(this,"components");f(this,"world");f(this,"_controlsActive",!1);f(this,"_arrowBoundBox",new L.Mesh);f(this,"_planeMesh");f(this,"_controls");f(this,"_hiddenMaterial",new L.MeshBasicMaterial({visible:!1}));f(this,"update",async()=>{this._enabled&&this.three.setFromNormalAndCoplanarPoint(this.normal,this._helper.position)});f(this,"changeDrag",s=>{this._visible=!s.value,this.preventCameraMovement(),this.notifyDraggingChanged(s)});if(this.components=s,this.world=t,!t.renderer)throw new Error("The given world must have a renderer!");this.normal=i,this.origin=e,t.renderer.setPlane(!0,this.three),this._planeMesh=As.newPlaneMesh(n,o),this._helper=this.newHelper(),this._controls=this.newTransformControls(),this.three.setFromNormalAndCoplanarPoint(i,e),r&&this.toggleControls(!0)}get enabled(){return this._enabled}set enabled(s){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");this._enabled=s,this.world.renderer.setPlane(s,this.three)}get visible(){return this._visible}set visible(s){this._visible=s,this._controls.visible=s,this._helper.visible=s,this.toggleControls(s)}get meshes(){return[this._planeMesh,this._arrowBoundBox]}get planeMaterial(){return this._planeMesh.material}set planeMaterial(s){this._planeMesh.material=s}get size(){return this._planeMesh.scale.x}set size(s){this._planeMesh.scale.set(s,s,s)}get helper(){return this._helper}async setFromNormalAndCoplanarPoint(s,t){this.reset(),this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix(),await this.update()}dispose(){this._enabled=!1,this.onDraggingStarted.reset(),this.onDraggingEnded.reset(),this._helper.removeFromParent(),this.world.renderer&&this.world.renderer.setPlane(!1,this.three),this._arrowBoundBox.removeFromParent(),this._arrowBoundBox.geometry.dispose(),this._planeMesh.geometry.dispose(),this._controls.removeFromParent(),this._controls.dispose(),this.onDisposed.trigger(),this.onDisposed.reset()}reset(){const s=new L.Vector3(1,0,0),t=new L.Vector3;this.normal.equals(s)||(this.normal.copy(s),this._helper.lookAt(s)),this.origin.copy(t),this._helper.position.copy(t),this._helper.updateMatrix()}toggleControls(s){if(s){if(this._controlsActive)return;this._controls.addEventListener("change",this.update),this._controls.addEventListener("dragging-changed",this.changeDrag)}else this._controls.removeEventListener("change",this.update),this._controls.removeEventListener("dragging-changed",this.changeDrag);this._controlsActive=s}newTransformControls(){if(!this.world.renderer)throw new Error("No renderer found for clipping plane!");const s=this.world.camera.three,t=this.world.renderer.three.domElement,e=new sr(s,t);return this.initializeControls(e),this.world.scene.three.add(e),e}initializeControls(s){s.attach(this._helper),s.showX=!1,s.showY=!1,s.setSpace("local"),this.createArrowBoundingBox(),s.children[0].children[0].add(this._arrowBoundBox)}createArrowBoundingBox(){this._arrowBoundBox.geometry=new L.CylinderGeometry(.18,.18,1.2),this._arrowBoundBox.material=this._hiddenMaterial,this._arrowBoundBox.rotateX(Math.PI/2),this._arrowBoundBox.updateMatrix(),this._arrowBoundBox.geometry.applyMatrix4(this._arrowBoundBox.matrix)}notifyDraggingChanged(s){s.value?this.onDraggingStarted.trigger():this.onDraggingEnded.trigger()}preventCameraMovement(){this.world.camera.enabled=this._visible}newHelper(){const s=new L.Object3D;return s.lookAt(this.normal),s.position.copy(this.origin),this._planeMesh.position.z+=.01,s.add(this._planeMesh),this.world.scene.three.add(s),s}static newPlaneMesh(s,t){const e=new L.PlaneGeometry(1),i=new L.Mesh(e,t);return i.scale.set(s,s,s),i}}const _e=class _e extends st{constructor(t){super(t);f(this,"onAfterCreate",new U);f(this,"onAfterDelete",new U);f(this,"onBeforeDrag",new U);f(this,"onAfterDrag",new U);f(this,"onBeforeCreate",new U);f(this,"onBeforeCancel",new U);f(this,"onAfterCancel",new U);f(this,"onBeforeDelete",new U);f(this,"onDisposed",new U);f(this,"orthogonalY",!1);f(this,"toleranceOrthogonalY",.7);f(this,"list",[]);f(this,"PlaneType");f(this,"_material",new L.MeshBasicMaterial({color:16776960,side:L.DoubleSide,transparent:!0,opacity:.2}));f(this,"_size",5);f(this,"_enabled",!1);f(this,"_visible",!1);f(this,"_onStartDragging",()=>{this.onBeforeDrag.trigger()});f(this,"_onEndDragging",()=>{this.onAfterDrag.trigger()});this.components.add(_e.uuid,this),this.PlaneType=As}get enabled(){return this._enabled}set enabled(t){this._enabled=t;for(const e of this.list)e.enabled=t;this.updateMaterialsAndPlanes()}get visible(){return this._visible}set visible(t){this._visible=t;for(const e of this.list)e.visible=t}get material(){return this._material}set material(t){this._material=t;for(const e of this.list)e.planeMaterial=t}get size(){return this._size}set size(t){this._size=t;for(const e of this.list)e.size=t}endCreation(){}cancelCreation(){}dispose(){this._enabled=!1;for(const t of this.list)t.dispose();this.list.length=0,this._material.dispose(),this.onBeforeCreate.reset(),this.onBeforeCancel.reset(),this.onBeforeDelete.reset(),this.onBeforeDrag.reset(),this.onAfterCreate.reset(),this.onAfterCancel.reset(),this.onAfterDelete.reset(),this.onAfterDrag.reset(),this.onDisposed.trigger(_e.uuid),this.onDisposed.reset()}create(t){if(!this.enabled)return;const o=this.components.get(Me).get(t).castRay();o&&this.createPlaneFromIntersection(t,o)}createFromNormalAndCoplanarPoint(t,e,i){const o=this.newPlane(t,i,e);return this.updateMaterialsAndPlanes(),o}delete(t,e){this.enabled&&(e||(e=this.pickPlane(t)),e&&this.deletePlane(e))}deleteAll(){for(;this.list.length>0;){const t=this.list[0];this.delete(t.world,t)}}deletePlane(t){const e=this.list.indexOf(t);if(e!==-1){if(this.list.splice(e,1),!t.world.renderer)throw new Error("Renderer not found for this plane's world!");t.world.renderer.setPlane(!1,t.three),t.dispose(),this.updateMaterialsAndPlanes(),this.onAfterDelete.trigger(t)}}pickPlane(t){const i=this.components.get(Me).get(t),o=this.getAllPlaneMeshes(),n=i.castRay(o);if(n){const r=n.object;return this.list.find(a=>a.meshes.includes(r))}}getAllPlaneMeshes(){const t=[];for(const e of this.list)t.push(...e.meshes);return t}createPlaneFromIntersection(t,e){var a;if(!t.renderer)throw new Error("The given world must have a renderer!");const i=e.point.distanceTo(new L.Vector3(0,0,0)),o=(a=e.face)==null?void 0:a.normal;if(!i||!o)return;const n=this.getWorldNormal(e,o),r=this.newPlane(t,e.point,n.negate());t.renderer.setPlane(!0,r.three),this.updateMaterialsAndPlanes()}getWorldNormal(t,e){const i=t.object;let o=t.object.matrixWorld.clone();if(i instanceof L.InstancedMesh&&t.instanceId!==void 0){const l=new L.Matrix4;i.getMatrixAt(t.instanceId,l),o=l.multiply(o)}const r=new L.Matrix3().getNormalMatrix(o),a=e.clone().applyMatrix3(r).normalize();return this.normalizePlaneDirectionY(a),a}normalizePlaneDirectionY(t){this.orthogonalY&&(t.y>this.toleranceOrthogonalY&&(t.x=0,t.y=1,t.z=0),t.y<-this.toleranceOrthogonalY&&(t.x=0,t.y=-1,t.z=0))}newPlane(t,e,i){const o=this.newPlaneInstance(t,e,i);return o.onDraggingStarted.add(this._onStartDragging),o.onDraggingEnded.add(this._onEndDragging),this.list.push(o),this.onAfterCreate.trigger(o),o}newPlaneInstance(t,e,i){return new this.PlaneType(this.components,t,e,i,this._material)}updateMaterialsAndPlanes(){const t=this.components.get(hs);for(const[e,i]of t.list){if(!i.renderer)continue;i.renderer.updateClippingPlanes();const{clippingPlanes:o}=i.renderer;for(const n of i.meshes)if(Array.isArray(n.material))for(const r of n.material)r.clippingPlanes=o;else n.material.clippingPlanes=o}}};f(_e,"uuid","66290bc5-18c4-4cd1-9379-2e17a0617611");let ii=_e;const Ne=class Ne extends st{constructor(t){super(t);f(this,"enabled",!0);f(this,"_originalBackground",new Map);f(this,"onDisposed",new U);f(this,"list",{});f(this,"_originals",{});this.components.add(Ne.uuid,this)}set(t,e=Object.keys(this.list)){for(const i of e){const{material:o,meshes:n}=this.list[i];for(const r of n)if(t)this._originals[r.uuid]||(this._originals[r.uuid]={material:r.material}),r instanceof L.InstancedMesh&&r.instanceColor&&(this._originals[r.uuid].instances=r.instanceColor,r.instanceColor=null),r.material=o;else{if(!this._originals[r.uuid])continue;r.material=this._originals[r.uuid].material;const a=this._originals[r.uuid].instances;r instanceof L.InstancedMesh&&a&&(r.instanceColor=a)}}}dispose(){for(const t in this.list){const{material:e}=this.list[t];e.dispose()}this.list={},this._originals={},this.onDisposed.trigger(Ne.uuid),this.onDisposed.reset(),this._originalBackground.clear()}setBackgroundColor(t,e){const i=e.scene.three;i instanceof L.Scene&&(this._originalBackground.has(e.uuid)||this._originalBackground.set(e.uuid,i.background),this._originalBackground&&(i.background=t))}resetBackgroundColor(t){const e=t.scene.three;if(!(e instanceof L.Scene))return;const i=this._originalBackground.get(t.uuid);i&&(e.background=i)}addMaterial(t,e){if(this.list[t])throw new Error("This ID already exists!");this.list[t]={material:e,meshes:new Set}}addMeshes(t,e){if(!this.list[t])throw new Error("This ID doesn't exists!");for(const i of e)this.list[t].meshes.add(i)}removeMeshes(t,e){if(!this.list[t])throw new Error("This ID doesn't exists!");for(const i of e)this.list[t].meshes.delete(i)}};f(Ne,"uuid","24989d27-fa2f-4797-8b08-35918f74e502");let ni=Ne;function hr(c,s,t,e){return new Promise((i,o)=>{function n(){const r=c.clientWaitSync(s,t,0);if(r===c.WAIT_FAILED){o();return}if(r===c.TIMEOUT_EXPIRED){setTimeout(n,e);return}i()}n()})}async function Er(c,s,t,e,i,o,n){const r=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);c.flush(),await hr(c,r,0,10),c.deleteSync(r),c.bindBuffer(s,t),c.getBufferSubData(s,e,i,o,n),c.bindBuffer(s,null)}async function Cn(c,s,t,e,i,o,n,r){const a=c.createBuffer();return c.bindBuffer(c.PIXEL_PACK_BUFFER,a),c.bufferData(c.PIXEL_PACK_BUFFER,r.byteLength,c.STREAM_READ),c.readPixels(s,t,e,i,o,n,0),c.bindBuffer(c.PIXEL_PACK_BUFFER,null),await Er(c,c.PIXEL_PACK_BUFFER,a,0,r),c.deleteBuffer(a),r}class pn{constructor(s,t,e){f(this,"onDisposed",new U);f(this,"onViewUpdated",new U);f(this,"enabled",!0);f(this,"needsUpdate",!1);f(this,"renderDebugFrame",!1);f(this,"components");f(this,"world");f(this,"renderer");f(this,"autoUpdate",!0);f(this,"updateInterval",1e3);f(this,"worker");f(this,"scene",new L.Scene);f(this,"_width",512);f(this,"_height",512);f(this,"_availableColor",1);f(this,"renderTarget");f(this,"bufferSize");f(this,"_buffer");f(this,"updateVisibility",async s=>{if(!this.enabled||!this.needsUpdate&&!s)return;const t=this.world.camera.three;t.updateMatrix(),this.renderer.setSize(this._width,this._height),this.renderer.setRenderTarget(this.renderTarget),this.renderer.render(this.scene,t);const e=this.renderer.getContext();await Cn(e,0,0,this._width,this._height,e.RGBA,e.UNSIGNED_BYTE,this._buffer),this.renderer.setRenderTarget(null),this.renderDebugFrame&&this.renderer.render(this.scene,t),this.worker.postMessage({buffer:this._buffer}),this.needsUpdate=!1});if(!t.renderer)throw new Error("The given world must have a renderer!");this.components=s,this.applySettings(e),this.world=t,this.renderer=new L.WebGLRenderer,this.renderTarget=new L.WebGLRenderTarget(this._width,this._height),this.bufferSize=this._width*this._height*4,this._buffer=new Uint8Array(this.bufferSize),this.renderer.clippingPlanes=t.renderer.clippingPlanes;const i=`
|
|
72
72
|
addEventListener("message", (event) => {
|
|
73
73
|
const { buffer } = event.data;
|
|
74
74
|
const colors = new Map();
|
package/dist/index.mjs
CHANGED
|
@@ -5319,7 +5319,7 @@ const be = class be extends nt {
|
|
|
5319
5319
|
* has to be `true` for this to apply.
|
|
5320
5320
|
*/
|
|
5321
5321
|
f(this, "toleranceOrthogonalY", 0.7);
|
|
5322
|
-
f(this, "
|
|
5322
|
+
f(this, "list", []);
|
|
5323
5323
|
f(this, "PlaneType");
|
|
5324
5324
|
/** The material used in all the clipping planes. */
|
|
5325
5325
|
f(this, "_material", new L.MeshBasicMaterial({
|
|
@@ -5346,7 +5346,7 @@ const be = class be extends nt {
|
|
|
5346
5346
|
/** {@link Component.enabled} */
|
|
5347
5347
|
set enabled(t) {
|
|
5348
5348
|
this._enabled = t;
|
|
5349
|
-
for (const e of this.
|
|
5349
|
+
for (const e of this.list)
|
|
5350
5350
|
e.enabled = t;
|
|
5351
5351
|
this.updateMaterialsAndPlanes();
|
|
5352
5352
|
}
|
|
@@ -5357,7 +5357,7 @@ const be = class be extends nt {
|
|
|
5357
5357
|
/** {@link Hideable.visible } */
|
|
5358
5358
|
set visible(t) {
|
|
5359
5359
|
this._visible = t;
|
|
5360
|
-
for (const e of this.
|
|
5360
|
+
for (const e of this.list)
|
|
5361
5361
|
e.visible = t;
|
|
5362
5362
|
}
|
|
5363
5363
|
/** The material of the clipping plane representation. */
|
|
@@ -5367,7 +5367,7 @@ const be = class be extends nt {
|
|
|
5367
5367
|
/** The material of the clipping plane representation. */
|
|
5368
5368
|
set material(t) {
|
|
5369
5369
|
this._material = t;
|
|
5370
|
-
for (const e of this.
|
|
5370
|
+
for (const e of this.list)
|
|
5371
5371
|
e.planeMaterial = t;
|
|
5372
5372
|
}
|
|
5373
5373
|
/** The size of the geometric representation of the clippings planes. */
|
|
@@ -5377,7 +5377,7 @@ const be = class be extends nt {
|
|
|
5377
5377
|
/** The size of the geometric representation of the clippings planes. */
|
|
5378
5378
|
set size(t) {
|
|
5379
5379
|
this._size = t;
|
|
5380
|
-
for (const e of this.
|
|
5380
|
+
for (const e of this.list)
|
|
5381
5381
|
e.size = t;
|
|
5382
5382
|
}
|
|
5383
5383
|
endCreation() {
|
|
@@ -5387,9 +5387,9 @@ const be = class be extends nt {
|
|
|
5387
5387
|
/** {@link Disposable.dispose} */
|
|
5388
5388
|
dispose() {
|
|
5389
5389
|
this._enabled = !1;
|
|
5390
|
-
for (const t of this.
|
|
5390
|
+
for (const t of this.list)
|
|
5391
5391
|
t.dispose();
|
|
5392
|
-
this.
|
|
5392
|
+
this.list.length = 0, this._material.dispose(), this.onBeforeCreate.reset(), this.onBeforeCancel.reset(), this.onBeforeDelete.reset(), this.onBeforeDrag.reset(), this.onAfterCreate.reset(), this.onAfterCancel.reset(), this.onAfterDelete.reset(), this.onAfterDrag.reset(), this.onDisposed.trigger(be.uuid), this.onDisposed.reset();
|
|
5393
5393
|
}
|
|
5394
5394
|
/** {@link Createable.create} */
|
|
5395
5395
|
create(t) {
|
|
@@ -5423,15 +5423,15 @@ const be = class be extends nt {
|
|
|
5423
5423
|
}
|
|
5424
5424
|
/** Deletes all the existing clipping planes. */
|
|
5425
5425
|
deleteAll() {
|
|
5426
|
-
for (; this.
|
|
5427
|
-
const t = this.
|
|
5426
|
+
for (; this.list.length > 0; ) {
|
|
5427
|
+
const t = this.list[0];
|
|
5428
5428
|
this.delete(t.world, t);
|
|
5429
5429
|
}
|
|
5430
5430
|
}
|
|
5431
5431
|
deletePlane(t) {
|
|
5432
|
-
const e = this.
|
|
5432
|
+
const e = this.list.indexOf(t);
|
|
5433
5433
|
if (e !== -1) {
|
|
5434
|
-
if (this.
|
|
5434
|
+
if (this.list.splice(e, 1), !t.world.renderer)
|
|
5435
5435
|
throw new Error("Renderer not found for this plane's world!");
|
|
5436
5436
|
t.world.renderer.setPlane(!1, t.three), t.dispose(), this.updateMaterialsAndPlanes(), this.onAfterDelete.trigger(t);
|
|
5437
5437
|
}
|
|
@@ -5440,12 +5440,12 @@ const be = class be extends nt {
|
|
|
5440
5440
|
const i = this.components.get(ms).get(t), o = this.getAllPlaneMeshes(), n = i.castRay(o);
|
|
5441
5441
|
if (n) {
|
|
5442
5442
|
const r = n.object;
|
|
5443
|
-
return this.
|
|
5443
|
+
return this.list.find((a) => a.meshes.includes(r));
|
|
5444
5444
|
}
|
|
5445
5445
|
}
|
|
5446
5446
|
getAllPlaneMeshes() {
|
|
5447
5447
|
const t = [];
|
|
5448
|
-
for (const e of this.
|
|
5448
|
+
for (const e of this.list)
|
|
5449
5449
|
t.push(...e.meshes);
|
|
5450
5450
|
return t;
|
|
5451
5451
|
}
|
|
@@ -5474,7 +5474,7 @@ const be = class be extends nt {
|
|
|
5474
5474
|
}
|
|
5475
5475
|
newPlane(t, e, i) {
|
|
5476
5476
|
const o = this.newPlaneInstance(t, e, i);
|
|
5477
|
-
return o.onDraggingStarted.add(this._onStartDragging), o.onDraggingEnded.add(this._onEndDragging), this.
|
|
5477
|
+
return o.onDraggingStarted.add(this._onStartDragging), o.onDraggingEnded.add(this._onEndDragging), this.list.push(o), this.onAfterCreate.trigger(o), o;
|
|
5478
5478
|
}
|
|
5479
5479
|
newPlaneInstance(t, e, i) {
|
|
5480
5480
|
return new this.PlaneType(
|