@shopware-ag/dive 2.0.1-beta.0 → 2.0.1-beta.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/build/chunks/{SelectTool-BRKko7uz.cjs → SelectTool-C7nerV4P.cjs} +1 -1
- package/build/chunks/{SelectTool-mTRiZYaC.mjs → SelectTool-DmuTopJx.mjs} +49 -49
- package/build/chunks/draco_decoder-Bh9flJPu.cjs +1 -0
- package/build/chunks/draco_decoder-CEzwqP9o.mjs +38 -0
- package/build/chunks/draco_decoder-DtHHc5d0.mjs +4 -0
- package/build/chunks/draco_decoder-DvYjcLz_.cjs +35 -0
- package/build/chunks/draco_wasm_wrapper-FoEVV9af.cjs +118 -0
- package/build/chunks/draco_wasm_wrapper-yQy2VLhb.mjs +121 -0
- package/build/chunks/{package-BFpY3sIj.cjs → package-BVRC9JGj.cjs} +1 -1
- package/build/chunks/{package-BvoZkrge.mjs → package-CgUmyOWW.mjs} +1 -1
- package/build/dive.cjs +2 -2
- package/build/dive.mjs +493 -587
- package/build/src/components/floor/Floor.d.ts +2 -2
- package/build/src/components/grid/Grid.d.ts +1 -1
- package/build/src/components/group/Group.d.ts +4 -4
- package/build/src/components/light/AmbientLight.d.ts +3 -3
- package/build/src/components/light/PointLight.d.ts +3 -3
- package/build/src/components/light/SceneLight.d.ts +3 -3
- package/build/src/components/model/Model.d.ts +7 -4
- package/build/src/components/node/Node.d.ts +6 -6
- package/build/src/components/primitive/Primitive.d.ts +4 -4
- package/build/src/components/root/Root.d.ts +19 -29
- package/build/src/core/Dive.d.ts +6 -6
- package/build/src/engine/Engine.d.ts +2 -6
- package/build/src/engine/scene/Scene.d.ts +4 -22
- package/build/src/engine/scene/xrroot/XRRoot.d.ts +2 -2
- package/build/src/engine/scene/xrroot/xrlightroot/XRLightRoot.d.ts +2 -2
- package/build/src/modules/animation/AnimationSystem.cjs +1 -1
- package/build/src/modules/animation/AnimationSystem.d.ts +2 -2
- package/build/src/modules/animation/AnimationSystem.mjs +2 -2
- package/build/src/modules/ar/webxr/WebXR.d.ts +2 -2
- package/build/src/modules/ar/webxr/controller/WebXRController.d.ts +3 -3
- package/build/src/modules/ar/webxr/crosshair/WebXRCrosshair.d.ts +2 -2
- package/build/src/modules/ar/webxr/origin/WebXROrigin.d.ts +3 -3
- package/build/src/modules/ar/webxr/overlay/Overlay.d.ts +2 -2
- package/build/src/modules/ar/webxr/raycaster/WebXRRaycaster.d.ts +4 -4
- package/build/src/modules/ar/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +3 -3
- package/build/src/modules/ar/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +2 -2
- package/build/src/modules/ar/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
- package/build/src/modules/asset/draco/DracoLoader.d.ts +10 -0
- package/build/src/modules/asset/loader/AssetLoader.cjs +4 -2
- package/build/src/modules/asset/loader/AssetLoader.mjs +1516 -1096
- package/build/src/modules/axiscamera/AxisCamera.d.ts +2 -2
- package/build/src/modules/events/EventExecutor.d.ts +1 -1
- package/build/src/modules/mediacreator/MediaCreator.cjs +1 -1
- package/build/src/modules/mediacreator/MediaCreator.d.ts +2 -2
- package/build/src/modules/mediacreator/MediaCreator.mjs +3 -3
- package/build/src/modules/state/State.cjs +6 -6
- package/build/src/modules/state/State.d.ts +1 -1
- package/build/src/modules/state/State.mjs +675 -650
- package/build/src/modules/state/actions/camera/movecamera.d.ts +2 -2
- package/build/src/modules/state/actions/object/addobject.d.ts +1 -1
- package/build/src/modules/state/actions/object/deleteobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/deselectobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/dropit.d.ts +2 -2
- package/build/src/modules/state/actions/object/getobjects.d.ts +2 -2
- package/build/src/modules/state/actions/object/placeonfloor.d.ts +2 -2
- package/build/src/modules/state/actions/object/selectobject.d.ts +2 -2
- package/build/src/modules/state/actions/object/setparent.d.ts +2 -2
- package/build/src/modules/state/actions/object/updateobject.d.ts +2 -2
- package/build/src/modules/state/actions/scene/getallscenedata.d.ts +1 -1
- package/build/src/modules/state/types/COMEntity.d.ts +5 -0
- package/build/src/modules/state/types/COMGroup.d.ts +1 -0
- package/build/src/modules/state/types/COMLight.d.ts +18 -2
- package/build/src/modules/state/types/COMModel.d.ts +1 -0
- package/build/src/modules/state/types/COMPov.d.ts +1 -0
- package/build/src/modules/state/types/COMPrimitive.d.ts +1 -0
- package/build/src/modules/toolbox/BaseTool.d.ts +2 -2
- package/build/src/modules/toolbox/Toolbox.cjs +1 -1
- package/build/src/modules/toolbox/Toolbox.d.ts +6 -6
- package/build/src/modules/toolbox/Toolbox.mjs +16 -16
- package/build/src/modules/toolbox/select/SelectTool.d.ts +5 -5
- package/build/src/modules/toolbox/transform/TransformTool.d.ts +4 -4
- package/build/src/types/SceneObjects.d.ts +3 -1
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ft=Object.defineProperty;var _t=(r,n,e)=>n in r?ft(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>_t(r,typeof n!="symbol"?n+"":n,e);const t=require("three"),J=require("./VisibilityLayerMask-BI7jPKdx.cjs"),y=require("./findInterface-BEdL2iUQ.cjs"),I=new t.Raycaster,p=new t.Vector3,E=new t.Vector3,c=new t.Quaternion,$={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},F={type:"change"},tt={type:"mouseDown"},et={type:"mouseUp",mode:null},it={type:"objectChange"};class yt extends t.Object3D{constructor(n,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const o=new vt;this._gizmo=o,this.add(o);const s=new Pt;this._plane=s,this.add(s);const a=this;function i(u,w){let G=w;Object.defineProperty(a,u,{get:function(){return G!==void 0?G:w},set:function(D){G!==D&&(G=D,s[u]=D,o[u]=D,a.dispatchEvent({type:u+"-changed",value:D}),a.dispatchEvent(F))}}),a[u]=w,s[u]=w,o[u]=w}i("camera",n),i("object",void 0),i("enabled",!0),i("axis",null),i("mode","translate"),i("translationSnap",null),i("rotationSnap",null),i("scaleSnap",null),i("space","world"),i("size",1),i("dragging",!1),i("showX",!0),i("showY",!0),i("showZ",!0);const d=new t.Vector3,f=new t.Vector3,x=new t.Quaternion,T=new t.Quaternion,j=new t.Vector3,z=new t.Quaternion,N=new t.Vector3,Z=new t.Vector3,S=new t.Vector3,v=0,b=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",x),i("worldQuaternionStart",T),i("cameraPosition",j),i("cameraQuaternion",z),i("pointStart",N),i("pointEnd",Z),i("rotationAxis",S),i("rotationAngle",v),i("eye",b),this._offset=new t.Vector3,this._startNorm=new t.Vector3,this._endNorm=new t.Vector3,this._cameraScale=new t.Vector3,this._parentPosition=new t.Vector3,this._parentQuaternion=new t.Quaternion,this._parentQuaternionInv=new t.Quaternion,this._parentScale=new t.Vector3,this._worldScaleStart=new t.Vector3,this._worldQuaternionInv=new t.Quaternion,this._worldScale=new t.Vector3,this._positionStart=new t.Vector3,this._quaternionStart=new t.Quaternion,this._scaleStart=new t.Vector3,this._getPointer=wt.bind(this),this._onPointerDown=bt.bind(this),this._onPointerHover=gt.bind(this),this._onPointerMove=Mt.bind(this),this._onPointerUp=St.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(n){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(n)}pointerHover(n){if(this.object===void 0||this.dragging===!0)return;n!==null&&I.setFromCamera(n,this.camera);const e=U(this._gizmo.picker[this.mode],I);e?this.axis=e.object.name:this.axis=null}pointerDown(n){if(!(this.object===void 0||this.dragging===!0||n!=null&&n.button!==0)&&this.axis!==null){n!==null&&I.setFromCamera(n,this.camera);const e=U(this._plane,I,!0);e&&(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(e.point).sub(this.worldPositionStart)),this.dragging=!0,tt.mode=this.mode,this.dispatchEvent(tt)}}pointerMove(n){const e=this.axis,o=this.mode,s=this.object;let a=this.space;if(o==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),s===void 0||e===null||this.dragging===!1||n!==null&&n.button!==-1)return;n!==null&&I.setFromCamera(n,this.camera);const i=U(this._plane,I,!0);if(i){if(this.pointEnd.copy(i.point).sub(this.worldPositionStart),o==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(s.position.applyQuaternion(c.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),a==="world"&&(s.parent&&s.position.add(p.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(p.setFromMatrixPosition(s.parent.matrixWorld))));else if(o==="scale"){if(e.search("XYZ")!==-1){let d=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(d*=-1),E.set(d,d,d)}else p.copy(this.pointStart),E.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),E.applyQuaternion(this._worldQuaternionInv),E.divide(p),e.search("X")===-1&&(E.x=1),e.search("Y")===-1&&(E.y=1),e.search("Z")===-1&&(E.z=1);s.scale.copy(this._scaleStart).multiply(E),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const d=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let f=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*d):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy($[e]),p.copy($[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?f=!0:this.rotationAngle=this._offset.dot(p.normalize())*d),(e==="E"||f)&&(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),a==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(F),this.dispatchEvent(it)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(et.mode=this.mode,this.dispatchEvent(et)),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(n){n.geometry&&n.geometry.dispose(),n.material&&n.material.dispose()})}attach(n){return this.object=n,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(F),this.dispatchEvent(it),this.pointStart.copy(this.pointEnd))}getRaycaster(){return I}getMode(){return this.mode}setMode(n){this.mode=n}setTranslationSnap(n){this.translationSnap=n}setRotationSnap(n){this.rotationSnap=n}setScaleSnap(n){this.scaleSnap=n}setSize(n){this.size=n}setSpace(n){this.space=n}}function wt(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const n=this.domElement.getBoundingClientRect();return{x:(r.clientX-n.left)/n.width*2-1,y:-(r.clientY-n.top)/n.height*2+1,button:r.button}}}function gt(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function bt(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Mt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function St(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function U(r,n,e){const o=n.intersectObject(r,!0);for(let s=0;s<o.length;s++)if(o[s].object.visible||e)return o[s];return!1}const k=new t.Euler,l=new t.Vector3(0,1,0),nt=new t.Vector3(0,0,0),ot=new t.Matrix4,q=new t.Quaternion,W=new t.Quaternion,M=new t.Vector3,st=new t.Matrix4,Y=new t.Vector3(1,0,0),A=new t.Vector3(0,1,0),O=new t.Vector3(0,0,1),B=new t.Vector3,C=new t.Vector3,X=new t.Vector3;class vt extends t.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const n=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone();o.opacity=.15;const s=e.clone();s.opacity=.5;const a=n.clone();a.color.setHex(16711680);const i=n.clone();i.color.setHex(65280);const d=n.clone();d.color.setHex(255);const f=n.clone();f.color.setHex(16711680),f.opacity=.5;const x=n.clone();x.color.setHex(65280),x.opacity=.5;const T=n.clone();T.color.setHex(255),T.opacity=.5;const j=n.clone();j.opacity=.25;const z=n.clone();z.color.setHex(16776960),z.opacity=.25,n.clone().color.setHex(16776960);const Z=n.clone();Z.color.setHex(7895160);const S=new t.CylinderGeometry(0,.04,.1,12);S.translate(0,.05,0);const v=new t.BoxGeometry(.08,.08,.08);v.translate(0,.04,0);const b=new t.BufferGeometry;b.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const u=new t.CylinderGeometry(.0075,.0075,.5,3);u.translate(0,.25,0);function w(_,H){const g=new t.TorusGeometry(_,.0075,3,64,H*Math.PI*2);return g.rotateY(Math.PI/2),g.rotateX(Math.PI/2),g}function G(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const D={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(S,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(u,i)]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(u,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),j.clone()),[0,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T.clone()),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),x.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},rt={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),o)]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},at={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new t.Line(G(),s),null,null,null,"helper"]],X:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},lt={XYZE:[[new t.Mesh(w(.5,1),Z),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(w(.5,.5),a)]],Y:[[new t.Mesh(w(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(w(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(w(.75,1),z),null,[0,Math.PI/2,0]]]},ht={AXIS:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},ct={XYZE:[[new t.Mesh(new t.SphereGeometry(.25,10,8),o)]],X:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(.75,.1,2,24),o)]]},dt={X:[[new t.Mesh(v,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(v,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(v,i),[0,.5,0]],[new t.Mesh(u,i)],[new t.Mesh(v,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(v,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(u,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(v,d),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),x),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),j.clone())]]},pt={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},ut={X:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function P(_){const H=new t.Object3D;for(const g in _)for(let Q=_[g].length;Q--;){const m=_[g][Q][0].clone(),L=_[g][Q][1],V=_[g][Q][2],R=_[g][Q][3],mt=_[g][Q][4];m.name=g,m.tag=mt,L&&m.position.set(L[0],L[1],L[2]),V&&m.rotation.set(V[0],V[1],V[2]),R&&m.scale.set(R[0],R[1],R[2]),m.updateMatrix();const K=m.geometry.clone();K.applyMatrix4(m.matrix),m.geometry=K,m.renderOrder=1/0,m.position.set(0,0,0),m.rotation.set(0,0,0),m.scale.set(1,1,1),H.add(m)}return H}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=P(D)),this.add(this.gizmo.rotate=P(lt)),this.add(this.gizmo.scale=P(dt)),this.add(this.picker.translate=P(rt)),this.add(this.picker.rotate=P(ct)),this.add(this.picker.scale=P(pt)),this.add(this.helper.translate=P(at)),this.add(this.helper.rotate=P(ht)),this.add(this.helper.scale=P(ut)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(n){const o=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:W;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 s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let a=0;a<s.length;a++){const i=s[a];i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition);let d;if(this.camera.isOrthographicCamera?d=(this.camera.top-this.camera.bottom)/this.camera.zoom:d=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),i.scale.set(1,1,1).multiplyScalar(d*this.size/4),i.tag==="helper"){i.visible=!1,i.name==="AXIS"?(i.visible=!!this.axis,this.axis==="X"&&(c.setFromEuler(k.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Y).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(k.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(A).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(k.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(k.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(ot.lookAt(nt,l,A)),i.quaternion.multiply(c),i.visible=this.dragging),this.axis==="E"&&(i.visible=!1)):i.name==="START"?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):i.name==="END"?(i.position.copy(this.worldPosition),i.visible=this.dragging):i.name==="DELTA"?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),p.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),p.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(p),i.visible=this.dragging):(i.quaternion.copy(o),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=this.axis.search(i.name)!==-1));continue}i.quaternion.copy(o),this.mode==="translate"||this.mode==="scale"?(i.name==="X"&&Math.abs(l.copy(Y).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Y"&&Math.abs(l.copy(A).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Z"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XY"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="YZ"&&Math.abs(l.copy(Y).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XZ"&&Math.abs(l.copy(A).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(q.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(ot.lookAt(this.eye,nt,A)),i.name==="X"&&(c.setFromAxisAngle(Y,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(q,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(A,Math.atan2(l.x,l.z)),c.multiplyQuaternions(q,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(O,Math.atan2(l.y,l.x)),c.multiplyQuaternions(q,c),i.quaternion.copy(c))),i.visible=i.visible&&(i.name.indexOf("X")===-1||this.showX),i.visible=i.visible&&(i.name.indexOf("Y")===-1||this.showY),i.visible=i.visible&&(i.name.indexOf("Z")===-1||this.showZ),i.visible=i.visible&&(i.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),i.material._color=i.material._color||i.material.color.clone(),i.material._opacity=i.material._opacity||i.material.opacity,i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled&&this.axis&&(i.name===this.axis||this.axis.split("").some(function(f){return i.name===f}))&&(i.material.color.setHex(16776960),i.material.opacity=1)}super.updateMatrixWorld(n)}}class Pt extends t.Mesh{constructor(){super(new t.PlaneGeometry(1e5,1e5,2,2),new t.MeshBasicMaterial({visible:!1,wireframe:!0,side:t.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(n){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),B.copy(Y).applyQuaternion(e==="local"?this.worldQuaternion:W),C.copy(A).applyQuaternion(e==="local"?this.worldQuaternion:W),X.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:W),l.copy(C),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(B),M.copy(B).cross(l);break;case"Y":l.copy(this.eye).cross(C),M.copy(C).cross(l);break;case"Z":l.copy(this.eye).cross(X),M.copy(X).cross(l);break;case"XY":M.copy(X);break;case"YZ":M.copy(B);break;case"XZ":l.copy(X),M.copy(C);break;case"XYZ":case"E":M.set(0,0,0);break}break;case"rotate":default:M.set(0,0,0)}M.length()===0?this.quaternion.copy(this.cameraQuaternion):(st.lookAt(p.set(0,0,0),M,l),this.quaternion.setFromRotationMatrix(st)),super.updateMatrixWorld(n)}}class Et{constructor(n,e){h(this,"POINTER_DRAG_THRESHOLD",.001);h(this,"name");h(this,"_canvas");h(this,"_scene");h(this,"_controller");h(this,"_pointer");h(this,"_pointerPrimaryDown");h(this,"_pointerMiddleDown");h(this,"_pointerSecondaryDown");h(this,"_lastPointerDown");h(this,"_lastPointerUp");h(this,"_raycaster");h(this,"_intersects");h(this,"_hovered");h(this,"_dragging");h(this,"_dragStart");h(this,"_dragCurrent");h(this,"_dragEnd");h(this,"_dragDelta");h(this,"_draggable");h(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=n,this._controller=e,this._pointer=new t.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new t.Vector2,this._lastPointerUp=new t.Vector2,this._raycaster=new t.Raycaster,this._raycaster.layers.mask=J.PRODUCT_LAYER_MASK|J.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new t.Vector3,this._dragCurrent=new t.Vector3,this._dragEnd=new t.Vector3,this._dragDelta=new t.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}Activate(){}Deactivate(){}onPointerDown(n){var e;switch(n.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+n.button)}this._lastPointerDown.copy(this._pointer),this._draggable=y.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(n){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(n){var o;this._pointer.x=n.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(n.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=y.findInterface((o=this._intersects[0])==null?void 0:o.object,"isHoverable");if(this._intersects[0]&&e){if(!this._hovered){e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}if(this._hovered.uuid!==e.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}e.onPointerOver&&e.onPointerOver(this._intersects[0]),this._hovered=e}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(n),this.onDrag(n))}onDrag(n){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const e=this._intersects[0];e&&(this._dragCurrent.copy(e.point.clone()),this._dragEnd.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(n){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(n):this.onClick(n),n.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(n){}onDragEnd(n){const e=this._intersects[0];e&&(this._dragEnd.copy(e.point.clone()),this._dragCurrent.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(n){}raycast(n){return n!==void 0?this._raycaster.intersectObjects(n,!0).filter(e=>e.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(e=>e.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}class xt extends Et{constructor(e,o){super(e,o);h(this,"isTransformTool",!0);h(this,"_scaleLinked");h(this,"_gizmo");this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}Activate(){}SetGizmoMode(e){this._gizmo.mode=e}SetGizmoVisibility(e){const o=this._scene.children.includes(this._gizmo);e&&!o?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&o&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}SetGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new yt(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(o=>{if(!("isMesh"in o))return;const s=o.material;o.name==="X"&&s.color.set(y.AxesColorRed),o.name==="Y"&&s.color.set(y.AxesColorGreen),o.name==="Z"&&s.color.set(y.AxesColorBlue),o.name==="XY"&&s.color.set(y.AxesColorBlue),o.name==="YZ"&&s.color.set(y.AxesColorRed),o.name==="XZ"&&s.color.set(y.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,y.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(y.implementsInterface(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const o=e.object.scale,s=(o.x+o.y+o.z)/3;e.object.scale.set(s,s,s)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,y.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Dt=r=>r.isSelectTool!==void 0;class It extends xt{constructor(e,o){super(e,o);h(this,"isSelectTool",!0);this.name="SelectTool"}Activate(){}Select(e){this.AttachGizmo(e),e.onSelect&&e.onSelect()}Deselect(e){this.DetachGizmo(),e.onDeselect&&e.onDeselect()}AttachGizmo(e){if("isMovable"in e){const o=e;this._gizmo.attach(o),this.SetGizmoVisibility(o.visible)}}DetachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const o=this._raycaster.intersectObjects(this._scene.Root.children,!0).filter(a=>a.object.visible)[0],s=y.findInterface(o==null?void 0:o.object,"isSelectable");if(!o||!s){this._gizmo.object&&this.Deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===s.uuid)return;this.Deselect(this._gizmo.object)}this.Select(s)}}exports.DIVESelectTool=It;exports.isSelectTool=Dt;
|
|
1
|
+
"use strict";var ft=Object.defineProperty;var _t=(r,n,e)=>n in r?ft(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>_t(r,typeof n!="symbol"?n+"":n,e);const t=require("three"),J=require("./VisibilityLayerMask-BI7jPKdx.cjs"),y=require("./findInterface-BEdL2iUQ.cjs"),I=new t.Raycaster,p=new t.Vector3,E=new t.Vector3,c=new t.Quaternion,$={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},F={type:"change"},tt={type:"mouseDown"},et={type:"mouseUp",mode:null},it={type:"objectChange"};class yt extends t.Object3D{constructor(n,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const o=new vt;this._gizmo=o,this.add(o);const s=new Pt;this._plane=s,this.add(s);const a=this;function i(u,w){let G=w;Object.defineProperty(a,u,{get:function(){return G!==void 0?G:w},set:function(D){G!==D&&(G=D,s[u]=D,o[u]=D,a.dispatchEvent({type:u+"-changed",value:D}),a.dispatchEvent(F))}}),a[u]=w,s[u]=w,o[u]=w}i("camera",n),i("object",void 0),i("enabled",!0),i("axis",null),i("mode","translate"),i("translationSnap",null),i("rotationSnap",null),i("scaleSnap",null),i("space","world"),i("size",1),i("dragging",!1),i("showX",!0),i("showY",!0),i("showZ",!0);const d=new t.Vector3,f=new t.Vector3,x=new t.Quaternion,A=new t.Quaternion,j=new t.Vector3,z=new t.Quaternion,N=new t.Vector3,Z=new t.Vector3,S=new t.Vector3,v=0,b=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",x),i("worldQuaternionStart",A),i("cameraPosition",j),i("cameraQuaternion",z),i("pointStart",N),i("pointEnd",Z),i("rotationAxis",S),i("rotationAngle",v),i("eye",b),this._offset=new t.Vector3,this._startNorm=new t.Vector3,this._endNorm=new t.Vector3,this._cameraScale=new t.Vector3,this._parentPosition=new t.Vector3,this._parentQuaternion=new t.Quaternion,this._parentQuaternionInv=new t.Quaternion,this._parentScale=new t.Vector3,this._worldScaleStart=new t.Vector3,this._worldQuaternionInv=new t.Quaternion,this._worldScale=new t.Vector3,this._positionStart=new t.Vector3,this._quaternionStart=new t.Quaternion,this._scaleStart=new t.Vector3,this._getPointer=wt.bind(this),this._onPointerDown=bt.bind(this),this._onPointerHover=gt.bind(this),this._onPointerMove=Mt.bind(this),this._onPointerUp=St.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(n){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(n)}pointerHover(n){if(this.object===void 0||this.dragging===!0)return;n!==null&&I.setFromCamera(n,this.camera);const e=U(this._gizmo.picker[this.mode],I);e?this.axis=e.object.name:this.axis=null}pointerDown(n){if(!(this.object===void 0||this.dragging===!0||n!=null&&n.button!==0)&&this.axis!==null){n!==null&&I.setFromCamera(n,this.camera);const e=U(this._plane,I,!0);e&&(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(e.point).sub(this.worldPositionStart)),this.dragging=!0,tt.mode=this.mode,this.dispatchEvent(tt)}}pointerMove(n){const e=this.axis,o=this.mode,s=this.object;let a=this.space;if(o==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),s===void 0||e===null||this.dragging===!1||n!==null&&n.button!==-1)return;n!==null&&I.setFromCamera(n,this.camera);const i=U(this._plane,I,!0);if(i){if(this.pointEnd.copy(i.point).sub(this.worldPositionStart),o==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(s.position.applyQuaternion(c.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),a==="world"&&(s.parent&&s.position.add(p.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(p.setFromMatrixPosition(s.parent.matrixWorld))));else if(o==="scale"){if(e.search("XYZ")!==-1){let d=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(d*=-1),E.set(d,d,d)}else p.copy(this.pointStart),E.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),E.applyQuaternion(this._worldQuaternionInv),E.divide(p),e.search("X")===-1&&(E.x=1),e.search("Y")===-1&&(E.y=1),e.search("Z")===-1&&(E.z=1);s.scale.copy(this._scaleStart).multiply(E),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const d=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let f=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*d):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy($[e]),p.copy($[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?f=!0:this.rotationAngle=this._offset.dot(p.normalize())*d),(e==="E"||f)&&(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),a==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(F),this.dispatchEvent(it)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(et.mode=this.mode,this.dispatchEvent(et)),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(n){n.geometry&&n.geometry.dispose(),n.material&&n.material.dispose()})}attach(n){return this.object=n,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(F),this.dispatchEvent(it),this.pointStart.copy(this.pointEnd))}getRaycaster(){return I}getMode(){return this.mode}setMode(n){this.mode=n}setTranslationSnap(n){this.translationSnap=n}setRotationSnap(n){this.rotationSnap=n}setScaleSnap(n){this.scaleSnap=n}setSize(n){this.size=n}setSpace(n){this.space=n}}function wt(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const n=this.domElement.getBoundingClientRect();return{x:(r.clientX-n.left)/n.width*2-1,y:-(r.clientY-n.top)/n.height*2+1,button:r.button}}}function gt(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function bt(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Mt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function St(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function U(r,n,e){const o=n.intersectObject(r,!0);for(let s=0;s<o.length;s++)if(o[s].object.visible||e)return o[s];return!1}const k=new t.Euler,l=new t.Vector3(0,1,0),nt=new t.Vector3(0,0,0),ot=new t.Matrix4,q=new t.Quaternion,W=new t.Quaternion,M=new t.Vector3,st=new t.Matrix4,Y=new t.Vector3(1,0,0),T=new t.Vector3(0,1,0),O=new t.Vector3(0,0,1),B=new t.Vector3,C=new t.Vector3,X=new t.Vector3;class vt extends t.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const n=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone();o.opacity=.15;const s=e.clone();s.opacity=.5;const a=n.clone();a.color.setHex(16711680);const i=n.clone();i.color.setHex(65280);const d=n.clone();d.color.setHex(255);const f=n.clone();f.color.setHex(16711680),f.opacity=.5;const x=n.clone();x.color.setHex(65280),x.opacity=.5;const A=n.clone();A.color.setHex(255),A.opacity=.5;const j=n.clone();j.opacity=.25;const z=n.clone();z.color.setHex(16776960),z.opacity=.25,n.clone().color.setHex(16776960);const Z=n.clone();Z.color.setHex(7895160);const S=new t.CylinderGeometry(0,.04,.1,12);S.translate(0,.05,0);const v=new t.BoxGeometry(.08,.08,.08);v.translate(0,.04,0);const b=new t.BufferGeometry;b.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const u=new t.CylinderGeometry(.0075,.0075,.5,3);u.translate(0,.25,0);function w(_,H){const g=new t.TorusGeometry(_,.0075,3,64,H*Math.PI*2);return g.rotateY(Math.PI/2),g.rotateX(Math.PI/2),g}function G(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const D={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(S,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(u,i)]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(u,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),j.clone()),[0,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),A.clone()),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),x.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},rt={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),o)]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},at={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new t.Line(G(),s),null,null,null,"helper"]],X:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},lt={XYZE:[[new t.Mesh(w(.5,1),Z),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(w(.5,.5),a)]],Y:[[new t.Mesh(w(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(w(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(w(.75,1),z),null,[0,Math.PI/2,0]]]},ht={AXIS:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},ct={XYZE:[[new t.Mesh(new t.SphereGeometry(.25,10,8),o)]],X:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(.75,.1,2,24),o)]]},dt={X:[[new t.Mesh(v,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(u,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(v,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(v,i),[0,.5,0]],[new t.Mesh(u,i)],[new t.Mesh(v,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(v,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(u,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(v,d),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),A),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),x),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),j.clone())]]},pt={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},ut={X:[[new t.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function P(_){const H=new t.Object3D;for(const g in _)for(let Q=_[g].length;Q--;){const m=_[g][Q][0].clone(),L=_[g][Q][1],V=_[g][Q][2],R=_[g][Q][3],mt=_[g][Q][4];m.name=g,m.tag=mt,L&&m.position.set(L[0],L[1],L[2]),V&&m.rotation.set(V[0],V[1],V[2]),R&&m.scale.set(R[0],R[1],R[2]),m.updateMatrix();const K=m.geometry.clone();K.applyMatrix4(m.matrix),m.geometry=K,m.renderOrder=1/0,m.position.set(0,0,0),m.rotation.set(0,0,0),m.scale.set(1,1,1),H.add(m)}return H}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=P(D)),this.add(this.gizmo.rotate=P(lt)),this.add(this.gizmo.scale=P(dt)),this.add(this.picker.translate=P(rt)),this.add(this.picker.rotate=P(ct)),this.add(this.picker.scale=P(pt)),this.add(this.helper.translate=P(at)),this.add(this.helper.rotate=P(ht)),this.add(this.helper.scale=P(ut)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(n){const o=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:W;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 s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let a=0;a<s.length;a++){const i=s[a];i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition);let d;if(this.camera.isOrthographicCamera?d=(this.camera.top-this.camera.bottom)/this.camera.zoom:d=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),i.scale.set(1,1,1).multiplyScalar(d*this.size/4),i.tag==="helper"){i.visible=!1,i.name==="AXIS"?(i.visible=!!this.axis,this.axis==="X"&&(c.setFromEuler(k.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Y).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(k.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(T).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(k.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(k.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(ot.lookAt(nt,l,T)),i.quaternion.multiply(c),i.visible=this.dragging),this.axis==="E"&&(i.visible=!1)):i.name==="START"?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):i.name==="END"?(i.position.copy(this.worldPosition),i.visible=this.dragging):i.name==="DELTA"?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),p.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),p.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(p),i.visible=this.dragging):(i.quaternion.copy(o),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=this.axis.search(i.name)!==-1));continue}i.quaternion.copy(o),this.mode==="translate"||this.mode==="scale"?(i.name==="X"&&Math.abs(l.copy(Y).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Y"&&Math.abs(l.copy(T).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Z"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XY"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="YZ"&&Math.abs(l.copy(Y).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XZ"&&Math.abs(l.copy(T).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(q.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(ot.lookAt(this.eye,nt,T)),i.name==="X"&&(c.setFromAxisAngle(Y,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(q,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(T,Math.atan2(l.x,l.z)),c.multiplyQuaternions(q,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(O,Math.atan2(l.y,l.x)),c.multiplyQuaternions(q,c),i.quaternion.copy(c))),i.visible=i.visible&&(i.name.indexOf("X")===-1||this.showX),i.visible=i.visible&&(i.name.indexOf("Y")===-1||this.showY),i.visible=i.visible&&(i.name.indexOf("Z")===-1||this.showZ),i.visible=i.visible&&(i.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),i.material._color=i.material._color||i.material.color.clone(),i.material._opacity=i.material._opacity||i.material.opacity,i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled&&this.axis&&(i.name===this.axis||this.axis.split("").some(function(f){return i.name===f}))&&(i.material.color.setHex(16776960),i.material.opacity=1)}super.updateMatrixWorld(n)}}class Pt extends t.Mesh{constructor(){super(new t.PlaneGeometry(1e5,1e5,2,2),new t.MeshBasicMaterial({visible:!1,wireframe:!0,side:t.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(n){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),B.copy(Y).applyQuaternion(e==="local"?this.worldQuaternion:W),C.copy(T).applyQuaternion(e==="local"?this.worldQuaternion:W),X.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:W),l.copy(C),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(B),M.copy(B).cross(l);break;case"Y":l.copy(this.eye).cross(C),M.copy(C).cross(l);break;case"Z":l.copy(this.eye).cross(X),M.copy(X).cross(l);break;case"XY":M.copy(X);break;case"YZ":M.copy(B);break;case"XZ":l.copy(X),M.copy(C);break;case"XYZ":case"E":M.set(0,0,0);break}break;case"rotate":default:M.set(0,0,0)}M.length()===0?this.quaternion.copy(this.cameraQuaternion):(st.lookAt(p.set(0,0,0),M,l),this.quaternion.setFromRotationMatrix(st)),super.updateMatrixWorld(n)}}class Et{constructor(n,e){h(this,"POINTER_DRAG_THRESHOLD",.001);h(this,"name");h(this,"_canvas");h(this,"_scene");h(this,"_controller");h(this,"_pointer");h(this,"_pointerPrimaryDown");h(this,"_pointerMiddleDown");h(this,"_pointerSecondaryDown");h(this,"_lastPointerDown");h(this,"_lastPointerUp");h(this,"_raycaster");h(this,"_intersects");h(this,"_hovered");h(this,"_dragging");h(this,"_dragStart");h(this,"_dragCurrent");h(this,"_dragEnd");h(this,"_dragDelta");h(this,"_draggable");h(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=n,this._controller=e,this._pointer=new t.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new t.Vector2,this._lastPointerUp=new t.Vector2,this._raycaster=new t.Raycaster,this._raycaster.layers.mask=J.PRODUCT_LAYER_MASK|J.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new t.Vector3,this._dragCurrent=new t.Vector3,this._dragEnd=new t.Vector3,this._dragDelta=new t.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}activate(){}deactivate(){}onPointerDown(n){var e;switch(n.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+n.button)}this._lastPointerDown.copy(this._pointer),this._draggable=y.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(n){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(n){var o;this._pointer.x=n.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(n.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=y.findInterface((o=this._intersects[0])==null?void 0:o.object,"isHoverable");if(this._intersects[0]&&e){if(!this._hovered){e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}if(this._hovered.uuid!==e.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}e.onPointerOver&&e.onPointerOver(this._intersects[0]),this._hovered=e}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(n),this.onDrag(n))}onDrag(n){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const e=this._intersects[0];e&&(this._dragCurrent.copy(e.point.clone()),this._dragEnd.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(n){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(n):this.onClick(n),n.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(n){}onDragEnd(n){const e=this._intersects[0];e&&(this._dragEnd.copy(e.point.clone()),this._dragCurrent.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(n){}raycast(n){return n!==void 0?this._raycaster.intersectObjects(n,!0).filter(e=>e.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(e=>e.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}class xt extends Et{constructor(e,o){super(e,o);h(this,"isTransformTool",!0);h(this,"_scaleLinked");h(this,"_gizmo");this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}activate(){}setGizmoMode(e){this._gizmo.mode=e}setGizmoVisibility(e){const o=this._scene.children.includes(this._gizmo);e&&!o?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&o&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}setGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new yt(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(o=>{if(!("isMesh"in o))return;const s=o.material;o.name==="X"&&s.color.set(y.AxesColorRed),o.name==="Y"&&s.color.set(y.AxesColorGreen),o.name==="Z"&&s.color.set(y.AxesColorBlue),o.name==="XY"&&s.color.set(y.AxesColorBlue),o.name==="YZ"&&s.color.set(y.AxesColorRed),o.name==="XZ"&&s.color.set(y.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,y.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(y.implementsInterface(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const o=e.object.scale,s=(o.x+o.y+o.z)/3;e.object.scale.set(s,s,s)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,y.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Dt=r=>r.isSelectTool!==void 0;class It extends xt{constructor(e,o){super(e,o);h(this,"isSelectTool",!0);this.name="SelectTool"}activate(){}select(e){this.attachGizmo(e),e.onSelect&&e.onSelect()}deselect(e){this.detachGizmo(),e.onDeselect&&e.onDeselect()}attachGizmo(e){if("isMovable"in e){const o=e;this._gizmo.attach(o),this.setGizmoVisibility(o.visible)}}detachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const o=this._raycaster.intersectObjects(this._scene.root.children,!0).filter(a=>a.object.visible)[0],s=y.findInterface(o==null?void 0:o.object,"isSelectable");if(!o||!s){this._gizmo.object&&this.deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===s.uuid)return;this.deselect(this._gizmo.object)}this.select(s)}}exports.DIVESelectTool=It;exports.isSelectTool=Dt;
|
|
@@ -2,14 +2,14 @@ var jt = Object.defineProperty;
|
|
|
2
2
|
var Xt = (r, i, t) => i in r ? jt(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
|
|
3
3
|
var c = (r, i, t) => Xt(r, typeof i != "symbol" ? i + "" : i, t);
|
|
4
4
|
import { Object3D as st, Vector3 as a, Quaternion as E, Raycaster as bt, MeshBasicMaterial as St, LineBasicMaterial as Yt, CylinderGeometry as w, BoxGeometry as f, BufferGeometry as lt, Float32BufferAttribute as ht, Mesh as o, OctahedronGeometry as B, Line as I, TorusGeometry as C, SphereGeometry as Qt, Euler as Zt, Matrix4 as vt, PlaneGeometry as Ht, DoubleSide as Ot, Vector2 as tt } from "three";
|
|
5
|
-
import { P as Ct, U as
|
|
5
|
+
import { P as Ct, U as kt } from "./VisibilityLayerMask-CXgt1fJc.mjs";
|
|
6
6
|
import { f as ot, A as ct, a as dt, b as pt, i as et } from "./findInterface-OrXgmwxj.mjs";
|
|
7
|
-
const j = new bt(), u = new a(),
|
|
7
|
+
const j = new bt(), u = new a(), z = new a(), d = new E(), ut = {
|
|
8
8
|
X: new a(1, 0, 0),
|
|
9
9
|
Y: new a(0, 1, 0),
|
|
10
10
|
Z: new a(0, 0, 1)
|
|
11
11
|
}, it = { type: "change" }, mt = { type: "mouseDown" }, ft = { type: "mouseUp", mode: null }, _t = { type: "objectChange" };
|
|
12
|
-
class
|
|
12
|
+
class Lt extends st {
|
|
13
13
|
constructor(i, t) {
|
|
14
14
|
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";
|
|
15
15
|
const n = new Ut();
|
|
@@ -23,14 +23,14 @@ class kt extends st {
|
|
|
23
23
|
get: function() {
|
|
24
24
|
return Q !== void 0 ? Q : b;
|
|
25
25
|
},
|
|
26
|
-
set: function(
|
|
27
|
-
Q !==
|
|
26
|
+
set: function(A) {
|
|
27
|
+
Q !== A && (Q = A, s[m] = A, n[m] = A, l.dispatchEvent({ type: m + "-changed", value: A }), l.dispatchEvent(it));
|
|
28
28
|
}
|
|
29
29
|
}), l[m] = b, s[m] = b, n[m] = b;
|
|
30
30
|
}
|
|
31
31
|
e("camera", i), e("object", void 0), e("enabled", !0), e("axis", null), e("mode", "translate"), e("translationSnap", null), e("rotationSnap", null), e("scaleSnap", null), e("space", "world"), e("size", 1), e("dragging", !1), e("showX", !0), e("showY", !0), e("showZ", !0);
|
|
32
|
-
const p = new a(), g = new a(),
|
|
33
|
-
e("worldPosition", p), e("worldPositionStart", g), e("worldQuaternion",
|
|
32
|
+
const p = new a(), g = new a(), T = new E(), Y = new E(), H = new a(), O = new E(), at = new a(), q = new a(), M = new a(), x = 0, v = new a();
|
|
33
|
+
e("worldPosition", p), e("worldPositionStart", g), e("worldQuaternion", T), e("worldQuaternionStart", Y), e("cameraPosition", H), e("cameraQuaternion", O), e("pointStart", at), e("pointEnd", q), e("rotationAxis", M), e("rotationAngle", x), e("eye", v), this._offset = new a(), this._startNorm = new a(), this._endNorm = new a(), this._cameraScale = new a(), this._parentPosition = new a(), this._parentQuaternion = new E(), this._parentQuaternionInv = new E(), this._parentScale = new a(), this._worldScaleStart = new a(), this._worldQuaternionInv = new E(), this._worldScale = new a(), this._positionStart = new a(), this._quaternionStart = new E(), this._scaleStart = new a(), this._getPointer = Rt.bind(this), this._onPointerDown = qt.bind(this), this._onPointerHover = Gt.bind(this), this._onPointerMove = Wt.bind(this), this._onPointerUp = Ft.bind(this), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointermove", this._onPointerHover), this.domElement.addEventListener("pointerup", this._onPointerUp);
|
|
34
34
|
}
|
|
35
35
|
// updateMatrixWorld updates key transformation variables
|
|
36
36
|
updateMatrixWorld(i) {
|
|
@@ -61,10 +61,10 @@ class kt extends st {
|
|
|
61
61
|
else if (n === "scale") {
|
|
62
62
|
if (t.search("XYZ") !== -1) {
|
|
63
63
|
let p = this.pointEnd.length() / this.pointStart.length();
|
|
64
|
-
this.pointEnd.dot(this.pointStart) < 0 && (p *= -1),
|
|
64
|
+
this.pointEnd.dot(this.pointStart) < 0 && (p *= -1), z.set(p, p, p);
|
|
65
65
|
} else
|
|
66
|
-
u.copy(this.pointStart),
|
|
67
|
-
s.scale.copy(this._scaleStart).multiply(
|
|
66
|
+
u.copy(this.pointStart), z.copy(this.pointEnd), u.applyQuaternion(this._worldQuaternionInv), z.applyQuaternion(this._worldQuaternionInv), z.divide(u), t.search("X") === -1 && (z.x = 1), t.search("Y") === -1 && (z.y = 1), t.search("Z") === -1 && (z.z = 1);
|
|
67
|
+
s.scale.copy(this._scaleStart).multiply(z), this.scaleSnap && (t.search("X") !== -1 && (s.scale.x = Math.round(s.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Y") !== -1 && (s.scale.y = Math.round(s.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap), t.search("Z") !== -1 && (s.scale.z = Math.round(s.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap));
|
|
68
68
|
} else if (n === "rotate") {
|
|
69
69
|
this._offset.copy(this.pointEnd).sub(this.pointStart);
|
|
70
70
|
const p = 20 / this.worldPosition.distanceTo(u.setFromMatrixPosition(this.camera.matrixWorld));
|
|
@@ -119,7 +119,7 @@ class kt extends st {
|
|
|
119
119
|
this.space = i;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function Rt(r) {
|
|
123
123
|
if (this.domElement.ownerDocument.pointerLockElement)
|
|
124
124
|
return {
|
|
125
125
|
x: 0,
|
|
@@ -160,7 +160,7 @@ function nt(r, i, t) {
|
|
|
160
160
|
return n[s];
|
|
161
161
|
return !1;
|
|
162
162
|
}
|
|
163
|
-
const N = new Zt(), h = new a(0, 1, 0), wt = new a(0, 0, 0), gt = new vt(), K = new E(), $ = new E(), P = new a(), yt = new vt(),
|
|
163
|
+
const N = new Zt(), h = new a(0, 1, 0), wt = new a(0, 0, 0), gt = new vt(), K = new E(), $ = new E(), P = new a(), yt = new vt(), R = new a(1, 0, 0), X = new a(0, 1, 0), G = new a(0, 0, 1), J = new a(), k = new a(), L = new a();
|
|
164
164
|
class Ut extends st {
|
|
165
165
|
constructor() {
|
|
166
166
|
super(), this.isTransformControlsGizmo = !0, this.type = "TransformControlsGizmo";
|
|
@@ -188,8 +188,8 @@ class Ut extends st {
|
|
|
188
188
|
p.color.setHex(255);
|
|
189
189
|
const g = i.clone();
|
|
190
190
|
g.color.setHex(16711680), g.opacity = 0.5;
|
|
191
|
-
const
|
|
192
|
-
|
|
191
|
+
const T = i.clone();
|
|
192
|
+
T.color.setHex(65280), T.opacity = 0.5;
|
|
193
193
|
const Y = i.clone();
|
|
194
194
|
Y.color.setHex(255), Y.opacity = 0.5;
|
|
195
195
|
const H = i.clone();
|
|
@@ -214,7 +214,7 @@ class Ut extends st {
|
|
|
214
214
|
const y = new lt();
|
|
215
215
|
return y.setAttribute("position", new ht([0, 0, 0, 1, 1, 1], 3)), y;
|
|
216
216
|
}
|
|
217
|
-
const
|
|
217
|
+
const A = {
|
|
218
218
|
X: [
|
|
219
219
|
[new o(M, l), [0.5, 0, 0], [0, 0, -Math.PI / 2]],
|
|
220
220
|
[new o(M, l), [-0.5, 0, 0], [0, 0, Math.PI / 2]],
|
|
@@ -240,7 +240,7 @@ class Ut extends st {
|
|
|
240
240
|
[new o(new f(0.15, 0.15, 0.01), g.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
241
241
|
],
|
|
242
242
|
XZ: [
|
|
243
|
-
[new o(new f(0.15, 0.15, 0.01),
|
|
243
|
+
[new o(new f(0.15, 0.15, 0.01), T.clone()), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
244
244
|
]
|
|
245
245
|
}, Pt = {
|
|
246
246
|
X: [
|
|
@@ -345,12 +345,12 @@ class Ut extends st {
|
|
|
345
345
|
[new o(new f(0.15, 0.15, 0.01), g), [0, 0.15, 0.15], [0, Math.PI / 2, 0]]
|
|
346
346
|
],
|
|
347
347
|
XZ: [
|
|
348
|
-
[new o(new f(0.15, 0.15, 0.01),
|
|
348
|
+
[new o(new f(0.15, 0.15, 0.01), T), [0.15, 0, 0.15], [-Math.PI / 2, 0, 0]]
|
|
349
349
|
],
|
|
350
350
|
XYZ: [
|
|
351
351
|
[new o(new f(0.1, 0.1, 0.1), H.clone())]
|
|
352
352
|
]
|
|
353
|
-
},
|
|
353
|
+
}, zt = {
|
|
354
354
|
X: [
|
|
355
355
|
[new o(new w(0.2, 0, 0.6, 4), n), [0.3, 0, 0], [0, 0, -Math.PI / 2]],
|
|
356
356
|
[new o(new w(0.2, 0, 0.6, 4), n), [-0.3, 0, 0], [0, 0, Math.PI / 2]]
|
|
@@ -375,7 +375,7 @@ class Ut extends st {
|
|
|
375
375
|
XYZ: [
|
|
376
376
|
[new o(new f(0.2, 0.2, 0.2), n), [0, 0, 0]]
|
|
377
377
|
]
|
|
378
|
-
},
|
|
378
|
+
}, Tt = {
|
|
379
379
|
X: [
|
|
380
380
|
[new I(v, s.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]
|
|
381
381
|
],
|
|
@@ -390,14 +390,14 @@ class Ut extends st {
|
|
|
390
390
|
const W = new st();
|
|
391
391
|
for (const S in y)
|
|
392
392
|
for (let Z = y[S].length; Z--; ) {
|
|
393
|
-
const _ = y[S][Z][0].clone(), F = y[S][Z][1], U = y[S][Z][2], V = y[S][Z][3],
|
|
394
|
-
_.name = S, _.tag =
|
|
393
|
+
const _ = y[S][Z][0].clone(), F = y[S][Z][1], U = y[S][Z][2], V = y[S][Z][3], At = y[S][Z][4];
|
|
394
|
+
_.name = S, _.tag = At, F && _.position.set(F[0], F[1], F[2]), U && _.rotation.set(U[0], U[1], U[2]), V && _.scale.set(V[0], V[1], V[2]), _.updateMatrix();
|
|
395
395
|
const rt = _.geometry.clone();
|
|
396
396
|
rt.applyMatrix4(_.matrix), _.geometry = rt, _.renderOrder = 1 / 0, _.position.set(0, 0, 0), _.rotation.set(0, 0, 0), _.scale.set(1, 1, 1), W.add(_);
|
|
397
397
|
}
|
|
398
398
|
return W;
|
|
399
399
|
}
|
|
400
|
-
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = D(
|
|
400
|
+
this.gizmo = {}, this.picker = {}, this.helper = {}, this.add(this.gizmo.translate = D(A)), this.add(this.gizmo.rotate = D(Mt)), this.add(this.gizmo.scale = D(It)), this.add(this.picker.translate = D(Pt)), this.add(this.picker.rotate = D(Dt)), this.add(this.picker.scale = D(zt)), this.add(this.helper.translate = D(Et)), this.add(this.helper.rotate = D(xt)), this.add(this.helper.scale = D(Tt)), this.picker.translate.visible = !1, this.picker.rotate.visible = !1, this.picker.scale.visible = !1;
|
|
401
401
|
}
|
|
402
402
|
// updateMatrixWorld will update transformations and appearance of individual handles
|
|
403
403
|
updateMatrixWorld(i) {
|
|
@@ -410,10 +410,10 @@ class Ut extends st {
|
|
|
410
410
|
e.visible = !0, e.rotation.set(0, 0, 0), e.position.copy(this.worldPosition);
|
|
411
411
|
let p;
|
|
412
412
|
if (this.camera.isOrthographicCamera ? p = (this.camera.top - this.camera.bottom) / this.camera.zoom : p = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7), e.scale.set(1, 1, 1).multiplyScalar(p * this.size / 4), e.tag === "helper") {
|
|
413
|
-
e.visible = !1, e.name === "AXIS" ? (e.visible = !!this.axis, this.axis === "X" && (d.setFromEuler(N.set(0, 0, 0)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(
|
|
413
|
+
e.visible = !1, e.name === "AXIS" ? (e.visible = !!this.axis, this.axis === "X" && (d.setFromEuler(N.set(0, 0, 0)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(R).applyQuaternion(n).dot(this.eye)) > 0.9 && (e.visible = !1)), this.axis === "Y" && (d.setFromEuler(N.set(0, 0, Math.PI / 2)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(X).applyQuaternion(n).dot(this.eye)) > 0.9 && (e.visible = !1)), this.axis === "Z" && (d.setFromEuler(N.set(0, Math.PI / 2, 0)), e.quaternion.copy(n).multiply(d), Math.abs(h.copy(G).applyQuaternion(n).dot(this.eye)) > 0.9 && (e.visible = !1)), this.axis === "XYZE" && (d.setFromEuler(N.set(0, Math.PI / 2, 0)), h.copy(this.rotationAxis), e.quaternion.setFromRotationMatrix(gt.lookAt(wt, h, X)), e.quaternion.multiply(d), e.visible = this.dragging), this.axis === "E" && (e.visible = !1)) : e.name === "START" ? (e.position.copy(this.worldPositionStart), e.visible = this.dragging) : e.name === "END" ? (e.position.copy(this.worldPosition), e.visible = this.dragging) : e.name === "DELTA" ? (e.position.copy(this.worldPositionStart), e.quaternion.copy(this.worldQuaternionStart), u.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1), u.applyQuaternion(this.worldQuaternionStart.clone().invert()), e.scale.copy(u), e.visible = this.dragging) : (e.quaternion.copy(n), this.dragging ? e.position.copy(this.worldPositionStart) : e.position.copy(this.worldPosition), this.axis && (e.visible = this.axis.search(e.name) !== -1));
|
|
414
414
|
continue;
|
|
415
415
|
}
|
|
416
|
-
e.quaternion.copy(n), this.mode === "translate" || this.mode === "scale" ? (e.name === "X" && Math.abs(h.copy(
|
|
416
|
+
e.quaternion.copy(n), this.mode === "translate" || this.mode === "scale" ? (e.name === "X" && Math.abs(h.copy(R).applyQuaternion(n).dot(this.eye)) > 0.99 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "Y" && Math.abs(h.copy(X).applyQuaternion(n).dot(this.eye)) > 0.99 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "Z" && Math.abs(h.copy(G).applyQuaternion(n).dot(this.eye)) > 0.99 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "XY" && Math.abs(h.copy(G).applyQuaternion(n).dot(this.eye)) < 0.2 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "YZ" && Math.abs(h.copy(R).applyQuaternion(n).dot(this.eye)) < 0.2 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1), e.name === "XZ" && Math.abs(h.copy(X).applyQuaternion(n).dot(this.eye)) < 0.2 && (e.scale.set(1e-10, 1e-10, 1e-10), e.visible = !1)) : this.mode === "rotate" && (K.copy(n), h.copy(this.eye).applyQuaternion(d.copy(n).invert()), e.name.search("E") !== -1 && e.quaternion.setFromRotationMatrix(gt.lookAt(this.eye, wt, X)), e.name === "X" && (d.setFromAxisAngle(R, Math.atan2(-h.y, h.z)), d.multiplyQuaternions(K, d), e.quaternion.copy(d)), e.name === "Y" && (d.setFromAxisAngle(X, Math.atan2(h.x, h.z)), d.multiplyQuaternions(K, d), e.quaternion.copy(d)), e.name === "Z" && (d.setFromAxisAngle(G, Math.atan2(h.y, h.x)), d.multiplyQuaternions(K, d), e.quaternion.copy(d))), e.visible = e.visible && (e.name.indexOf("X") === -1 || this.showX), e.visible = e.visible && (e.name.indexOf("Y") === -1 || this.showY), e.visible = e.visible && (e.name.indexOf("Z") === -1 || this.showZ), e.visible = e.visible && (e.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ), e.material._color = e.material._color || e.material.color.clone(), e.material._opacity = e.material._opacity || e.material.opacity, e.material.color.copy(e.material._color), e.material.opacity = e.material._opacity, this.enabled && this.axis && (e.name === this.axis || this.axis.split("").some(function(g) {
|
|
417
417
|
return e.name === g;
|
|
418
418
|
})) && (e.material.color.setHex(16776960), e.material.opacity = 1);
|
|
419
419
|
}
|
|
@@ -429,7 +429,7 @@ class Vt extends o {
|
|
|
429
429
|
}
|
|
430
430
|
updateMatrixWorld(i) {
|
|
431
431
|
let t = this.space;
|
|
432
|
-
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), J.copy(
|
|
432
|
+
switch (this.position.copy(this.worldPosition), this.mode === "scale" && (t = "local"), J.copy(R).applyQuaternion(t === "local" ? this.worldQuaternion : $), k.copy(X).applyQuaternion(t === "local" ? this.worldQuaternion : $), L.copy(G).applyQuaternion(t === "local" ? this.worldQuaternion : $), h.copy(k), this.mode) {
|
|
433
433
|
case "translate":
|
|
434
434
|
case "scale":
|
|
435
435
|
switch (this.axis) {
|
|
@@ -437,19 +437,19 @@ class Vt extends o {
|
|
|
437
437
|
h.copy(this.eye).cross(J), P.copy(J).cross(h);
|
|
438
438
|
break;
|
|
439
439
|
case "Y":
|
|
440
|
-
h.copy(this.eye).cross(
|
|
440
|
+
h.copy(this.eye).cross(k), P.copy(k).cross(h);
|
|
441
441
|
break;
|
|
442
442
|
case "Z":
|
|
443
|
-
h.copy(this.eye).cross(
|
|
443
|
+
h.copy(this.eye).cross(L), P.copy(L).cross(h);
|
|
444
444
|
break;
|
|
445
445
|
case "XY":
|
|
446
|
-
P.copy(
|
|
446
|
+
P.copy(L);
|
|
447
447
|
break;
|
|
448
448
|
case "YZ":
|
|
449
449
|
P.copy(J);
|
|
450
450
|
break;
|
|
451
451
|
case "XZ":
|
|
452
|
-
h.copy(
|
|
452
|
+
h.copy(L), P.copy(k);
|
|
453
453
|
break;
|
|
454
454
|
case "XYZ":
|
|
455
455
|
case "E":
|
|
@@ -491,14 +491,14 @@ class Bt {
|
|
|
491
491
|
c(this, "_dragDelta");
|
|
492
492
|
c(this, "_draggable");
|
|
493
493
|
c(this, "_dragRaycastOnObjects");
|
|
494
|
-
this.name = "BaseTool", this._canvas = t.domElement, this._scene = i, this._controller = t, this._pointer = new tt(), this._pointerPrimaryDown = !1, this._pointerMiddleDown = !1, this._pointerSecondaryDown = !1, this._lastPointerDown = new tt(), this._lastPointerUp = new tt(), this._raycaster = new bt(), this._raycaster.layers.mask = Ct |
|
|
494
|
+
this.name = "BaseTool", this._canvas = t.domElement, this._scene = i, this._controller = t, this._pointer = new tt(), this._pointerPrimaryDown = !1, this._pointerMiddleDown = !1, this._pointerSecondaryDown = !1, this._lastPointerDown = new tt(), this._lastPointerUp = new tt(), this._raycaster = new bt(), this._raycaster.layers.mask = Ct | kt, this._intersects = [], this._hovered = null, this._dragging = !1, this._dragStart = new a(), this._dragCurrent = new a(), this._dragEnd = new a(), this._dragDelta = new a(), this._draggable = null, this._dragRaycastOnObjects = null;
|
|
495
495
|
}
|
|
496
496
|
get _pointerAnyDown() {
|
|
497
497
|
return this._pointerPrimaryDown || this._pointerMiddleDown || this._pointerSecondaryDown;
|
|
498
498
|
}
|
|
499
|
-
|
|
499
|
+
activate() {
|
|
500
500
|
}
|
|
501
|
-
|
|
501
|
+
deactivate() {
|
|
502
502
|
}
|
|
503
503
|
onPointerDown(i) {
|
|
504
504
|
var t;
|
|
@@ -618,16 +618,16 @@ class Nt extends Bt {
|
|
|
618
618
|
c(this, "_gizmo");
|
|
619
619
|
this.name = "DIVETransformTool", this._scaleLinked = !1, this._gizmo = this.initGizmo(), this._scene.add(this._gizmo);
|
|
620
620
|
}
|
|
621
|
-
|
|
621
|
+
activate() {
|
|
622
622
|
}
|
|
623
|
-
|
|
623
|
+
setGizmoMode(t) {
|
|
624
624
|
this._gizmo.mode = t;
|
|
625
625
|
}
|
|
626
|
-
|
|
626
|
+
setGizmoVisibility(t) {
|
|
627
627
|
const n = this._scene.children.includes(this._gizmo);
|
|
628
628
|
t && !n ? (this._scene.add(this._gizmo), "isTransformControls" in this._gizmo && this._gizmo.getRaycaster().layers.enableAll()) : !t && n && (this._scene.remove(this._gizmo), "isTransformControls" in this._gizmo && this._gizmo.getRaycaster().layers.disableAll());
|
|
629
629
|
}
|
|
630
|
-
|
|
630
|
+
setGizmoScaleLinked(t) {
|
|
631
631
|
this._scaleLinked = t;
|
|
632
632
|
}
|
|
633
633
|
// only used for optimizing pointer events with DIVEGizmo
|
|
@@ -644,7 +644,7 @@ class Nt extends Bt {
|
|
|
644
644
|
// return super.raycast((this._gizmo as DIVEGizmo).gizmoNode.children);
|
|
645
645
|
// }
|
|
646
646
|
initGizmo() {
|
|
647
|
-
const t = new
|
|
647
|
+
const t = new Lt(
|
|
648
648
|
// this._controller,
|
|
649
649
|
this._controller.object,
|
|
650
650
|
this._controller.domElement
|
|
@@ -672,38 +672,38 @@ class ie extends Nt {
|
|
|
672
672
|
c(this, "isSelectTool", !0);
|
|
673
673
|
this.name = "SelectTool";
|
|
674
674
|
}
|
|
675
|
-
|
|
675
|
+
activate() {
|
|
676
676
|
}
|
|
677
|
-
|
|
678
|
-
this.
|
|
677
|
+
select(t) {
|
|
678
|
+
this.attachGizmo(t), t.onSelect && t.onSelect();
|
|
679
679
|
}
|
|
680
|
-
|
|
681
|
-
this.
|
|
680
|
+
deselect(t) {
|
|
681
|
+
this.detachGizmo(), t.onDeselect && t.onDeselect();
|
|
682
682
|
}
|
|
683
|
-
|
|
683
|
+
attachGizmo(t) {
|
|
684
684
|
if ("isMovable" in t) {
|
|
685
685
|
const n = t;
|
|
686
|
-
this._gizmo.attach(n), this.
|
|
686
|
+
this._gizmo.attach(n), this.setGizmoVisibility(n.visible);
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
|
|
689
|
+
detachGizmo() {
|
|
690
690
|
this._gizmo.detach();
|
|
691
691
|
}
|
|
692
692
|
onClick(t) {
|
|
693
693
|
super.onClick(t);
|
|
694
|
-
const n = this._raycaster.intersectObjects(this._scene.
|
|
694
|
+
const n = this._raycaster.intersectObjects(this._scene.root.children, !0).filter((l) => l.object.visible)[0], s = ot(
|
|
695
695
|
n == null ? void 0 : n.object,
|
|
696
696
|
"isSelectable"
|
|
697
697
|
);
|
|
698
698
|
if (!n || !s) {
|
|
699
|
-
this._gizmo.object && this.
|
|
699
|
+
this._gizmo.object && this.deselect(this._gizmo.object);
|
|
700
700
|
return;
|
|
701
701
|
}
|
|
702
702
|
if (this._gizmo.object) {
|
|
703
703
|
if (this._gizmo.object.uuid === s.uuid) return;
|
|
704
|
-
this.
|
|
704
|
+
this.deselect(this._gizmo.object);
|
|
705
705
|
}
|
|
706
|
-
this.
|
|
706
|
+
this.select(s);
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
709
|
export {
|