t3d-ez.gl 0.0.1 → 0.0.3

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.
Files changed (70) hide show
  1. package/dist/core/Addons/RaycasterAide.cjs.js +1 -0
  2. package/dist/core/Addons/RaycasterAide.esm.js +1 -0
  3. package/dist/core/Controls/TTControls/TTControls.cjs.js +1 -0
  4. package/dist/core/Controls/TTControls/TTControls.esm.js +1 -0
  5. package/dist/core/Controls/index.cjs.js +1 -1
  6. package/dist/core/Controls/index.esm.js +1 -1
  7. package/dist/core/Map/index.cjs.js +1 -1
  8. package/dist/core/Map/index.esm.js +1 -1
  9. package/dist/core/MarkerHtmlUI/index.cjs.js +1 -1
  10. package/dist/core/MarkerHtmlUI/index.esm.js +1 -1
  11. package/dist/core/Meshes/Builders/CapsuleBuilder.cjs.js +1 -0
  12. package/dist/core/Meshes/Builders/CapsuleBuilder.esm.js +1 -0
  13. package/dist/core/Meshes/index.cjs.js +1 -1
  14. package/dist/core/Meshes/index.esm.js +1 -1
  15. package/dist/core/Resource/loaders.cjs.js +1 -1
  16. package/dist/core/Resource/loaders.esm.js +1 -1
  17. package/dist/core/WebGLEngine/index.cjs.js +1 -1
  18. package/dist/core/WebGLEngine/index.esm.js +1 -1
  19. package/dist/helpers/AxesAddHelper.cjs.js +1 -0
  20. package/dist/helpers/AxesAddHelper.esm.js +1 -0
  21. package/dist/helpers/InfiniteGridHelper.cjs.js +1 -1
  22. package/dist/helpers/InfiniteGridHelper.esm.js +1 -1
  23. package/dist/helpers/T3DEzViewportGizmo.cjs.js +1 -0
  24. package/dist/helpers/T3DEzViewportGizmo.esm.js +1 -0
  25. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js +1 -1
  26. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js +1 -1
  27. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js +1 -1
  28. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js +1 -1
  29. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/Line2.cjs.js +1 -0
  30. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/Line2.esm.js +1 -0
  31. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineGeometry.cjs.js +1 -0
  32. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineGeometry.esm.js +1 -0
  33. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineMaterial.cjs.js +1 -0
  34. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineMaterial.esm.js +1 -0
  35. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineSegments2.cjs.js +1 -0
  36. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineSegments2.esm.js +1 -0
  37. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.cjs.js +1 -0
  38. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.esm.js +1 -0
  39. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/utils/BufferGeometryUtils.cjs.js +1 -1
  40. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/utils/BufferGeometryUtils.esm.js +1 -1
  41. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/src/math/MathUtils.cjs.js +1 -0
  42. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/src/math/MathUtils.esm.js +1 -0
  43. package/dist/package.json +4 -1
  44. package/dist/t3d-ez.gl.cjs.js +1 -1
  45. package/dist/t3d-ez.gl.esm.js +1 -1
  46. package/dist/types/core/Addons/RaycasterAide.d.ts +12 -0
  47. package/dist/types/core/Addons/index.d.ts +1 -0
  48. package/dist/types/core/Controls/TTControls/TTControls.d.ts +332 -0
  49. package/dist/types/core/Controls/index.d.ts +3 -2
  50. package/dist/types/core/Meshes/Builders/CapsuleBuilder.d.ts +19 -0
  51. package/dist/types/core/Meshes/Builders/index.d.ts +1 -0
  52. package/dist/types/core/Meshes/index.d.ts +3 -1
  53. package/dist/types/core/PostProcessor/index.d.ts +3 -3
  54. package/dist/types/core/Resource/ResourceManager.d.ts +1 -1
  55. package/dist/types/core/Resource/loaders.d.ts +2 -2
  56. package/dist/types/core/WebGLEngine/index.d.ts +2 -2
  57. package/dist/types/core/index.d.ts +1 -1
  58. package/dist/types/helpers/AxesAddHelper.d.ts +6 -0
  59. package/dist/types/helpers/T3DEzViewportGizmo.d.ts +271 -0
  60. package/dist/types/helpers/index.d.ts +2 -0
  61. package/dist/types/utils/index.d.ts +9 -0
  62. package/package.json +4 -1
  63. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/RGBELoader.cjs.js +0 -1
  64. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/RGBELoader.esm.js +0 -1
  65. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/physics/AmmoPhysics.cjs.js +0 -1
  66. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/physics/AmmoPhysics.esm.js +0 -1
  67. package/dist/types/core/Physics/index.d.ts +0 -1
  68. /package/dist/core/Map/{extrudeMap.cjs.js → ExtrudeMap.cjs.js} +0 -0
  69. /package/dist/core/Map/{extrudeMap.esm.js → ExtrudeMap.esm.js} +0 -0
  70. /package/dist/types/core/Map/{extrudeMap.d.ts → ExtrudeMap.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js");var e=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");class t extends e.Raycaster{name="RaycasterHelper";domContainer;activeMesh=null;activeGroup=null;constructor(e){super(),this.domContainer=e}activeSceneGraphMeshNode(e,t,r){const n=this.getIntersectNodes(e,t,r);if(0===n.length)return null;const o=n[0].object;return this.activeMesh=o,o}activeSceneGraphGroupNode(e,t,r,n="EditorGroup"){let o=this.activeSceneGraphMeshNode(e,t,r);if(null===o)return null;for(;o?.parent&&o?.parent.type!==n;)o=o?.parent;return o&&"Scene"!==o.type?this.activeGroup=o:this.activeGroup=null,this.activeGroup}getIntersectNodes(e,t,r){const n=this.getPointerVec2(e);this.setFromCamera(n,t);return this.intersectObjects(r,!0)}getPointerVec2(t){const r=new e.Vector2;return r.set((t.clientX-this.domContainer.getBoundingClientRect().left)/this.domContainer.offsetWidth*2-1,-(t.clientY-this.domContainer.getBoundingClientRect().top)/this.domContainer.offsetHeight*2+1),r}}exports.RaycasterAide=t;
@@ -0,0 +1 @@
1
+ import"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{Raycaster as e,Vector2 as t}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class n extends e{name="RaycasterHelper";domContainer;activeMesh=null;activeGroup=null;constructor(e){super(),this.domContainer=e}activeSceneGraphMeshNode(e,t,n){const r=this.getIntersectNodes(e,t,n);if(0===r.length)return null;const o=r[0].object;return this.activeMesh=o,o}activeSceneGraphGroupNode(e,t,n,r="EditorGroup"){let o=this.activeSceneGraphMeshNode(e,t,n);if(null===o)return null;for(;o?.parent&&o?.parent.type!==r;)o=o?.parent;return o&&"Scene"!==o.type?this.activeGroup=o:this.activeGroup=null,this.activeGroup}getIntersectNodes(e,t,n){const r=this.getPointerVec2(e);this.setFromCamera(r,t);return this.intersectObjects(n,!0)}getPointerVec2(e){const n=new t;return n.set((e.clientX-this.domContainer.getBoundingClientRect().left)/this.domContainer.offsetWidth*2-1,-(e.clientY-this.domContainer.getBoundingClientRect().top)/this.domContainer.offsetHeight*2+1),n}}export{n as RaycasterAide};
@@ -0,0 +1 @@
1
+ "use strict";require("../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js");var t=require("../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const e=new t.Raycaster,o=new t.Vector3,i=new t.Vector3,n=new t.Quaternion,s={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},a={type:"change"},r={type:"mouseDown",mode:null},h={type:"mouseUp",mode:null},c={type:"objectChange"};class l extends t.Controls{camera;axis;mode;translationSnap;rotationSnap;scaleSnap;space;size;dragging;showX;showY;showZ;minx;maxX;minY;maxY;minZ;maxZ;_root;_gizmo;_plane;constructor(e,o=null){super(e,o);const i=new I(this);this._root=i;const n=new Z;this._gizmo=n,i.add(n);const s=new z;this._plane=s,i.add(s);const r=this;function h(t,e){let o=e;Object.defineProperty(r,t,{get:function(){return void 0!==o?o:e},set:function(e){o!==e&&(o=e,s[t]=e,n[t]=e,r.dispatchEvent({type:t+"-changed",value:e}),r.dispatchEvent(a))}}),r[t]=e,s[t]=e,n[t]=e}h("camera",e),h("object",void 0),h("enabled",!0),h("axis",null),h("mode","translate"),h("translationSnap",null),h("rotationSnap",null),h("scaleSnap",null),h("space","world"),h("size",1),h("dragging",!1),h("showX",!0),h("showY",!0),h("showZ",!0),h("minX",-1/0),h("maxX",1/0),h("minY",-1/0),h("maxY",1/0),h("minZ",-1/0),h("maxZ",1/0);const c=new t.Vector3,l=new t.Vector3,w=new t.Quaternion,x=new t.Quaternion,M=new t.Vector3,b=new t.Quaternion,_=new t.Vector3,v=new t.Vector3,g=new t.Vector3,S=new t.Vector3;h("worldPosition",c),h("worldPositionStart",l),h("worldQuaternion",w),h("worldQuaternionStart",x),h("cameraPosition",M),h("cameraQuaternion",b),h("pointStart",_),h("pointEnd",v),h("rotationAxis",g),h("rotationAngle",0),h("eye",S),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=p.bind(this),this._onPointerDown=m.bind(this),this._onPointerHover=d.bind(this),this._onPointerMove=u.bind(this),this._onPointerUp=y.bind(this),null!==o&&this.connect(o)}connect(t){super.connect(t),this.domElement&&(this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none")}disconnect(){this.domElement&&(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.domElement.style.touchAction="auto")}getHelper(){return this._root}pointerHover(t){if(void 0===this.object||!0===this.dragging)return;null!==t&&e.setFromCamera(t,this.camera);const o=w(this._gizmo.picker[this.mode],e);o?(this.axis=o.object.name,this.showX=-1!==this.axis.search("X"),this.showY=-1!==this.axis.search("Y"),this.showZ=-1!==this.axis.search("Z")):(this.showX=this.showY=this.showZ=!0,this.axis=null)}pointerDown(o){if(void 0!==this.object&&!0!==this.dragging&&(null==o||0===o.button)&&null!==this.axis){null!==o&&e.setFromCamera(new t.Vector2(o.x,o.y),this.camera);const i=w(this._plane,e,!0);i&&(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(i.point).sub(this.worldPositionStart)),this.dragging=!0,r.mode=this.mode,this.dispatchEvent(r)}}pointerMove(r){const h=this.axis,l=this.mode,p=this.object;let d=this.space;if("scale"===l?d="local":"E"!==h&&"XYZE"!==h&&"XYZ"!==h||(d="world"),void 0===p||null===h||!1===this.dragging||null!==r&&-1!==r.button)return;null!==r&&e.setFromCamera(new t.Vector2(r.x,r.y),this.camera);const m=w(this._plane,e,!0);if(m){if(this.pointEnd.copy(m.point).sub(this.worldPositionStart),"translate"===l)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===d&&"XYZ"!==h&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===h.indexOf("X")&&(this._offset.x=0),-1===h.indexOf("Y")&&(this._offset.y=0),-1===h.indexOf("Z")&&(this._offset.z=0),"local"===d&&"XYZ"!==h?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),p.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===d&&(p.position.applyQuaternion(n.copy(this._quaternionStart).invert()),-1!==h.search("X")&&(p.position.x=Math.round(p.position.x/this.translationSnap)*this.translationSnap),-1!==h.search("Y")&&(p.position.y=Math.round(p.position.y/this.translationSnap)*this.translationSnap),-1!==h.search("Z")&&(p.position.z=Math.round(p.position.z/this.translationSnap)*this.translationSnap),p.position.applyQuaternion(this._quaternionStart)),"world"===d&&(p.parent&&p.position.add(o.setFromMatrixPosition(p.parent.matrixWorld)),-1!==h.search("X")&&(p.position.x=Math.round(p.position.x/this.translationSnap)*this.translationSnap),-1!==h.search("Y")&&(p.position.y=Math.round(p.position.y/this.translationSnap)*this.translationSnap),-1!==h.search("Z")&&(p.position.z=Math.round(p.position.z/this.translationSnap)*this.translationSnap),p.parent&&p.position.sub(o.setFromMatrixPosition(p.parent.matrixWorld)))),p.position.x=Math.max(this.minX,Math.min(this.maxX,p.position.x)),p.position.y=Math.max(this.minY,Math.min(this.maxY,p.position.y)),p.position.z=Math.max(this.minZ,Math.min(this.maxZ,p.position.z));else if("scale"===l){if(-1!==h.search("XYZ")){let t=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(t*=-1),i.set(t,t,t)}else o.copy(this.pointStart),i.copy(this.pointEnd),o.applyQuaternion(this._worldQuaternionInv),i.applyQuaternion(this._worldQuaternionInv),i.divide(o),-1===h.search("X")&&(i.x=1),-1===h.search("Y")&&(i.y=1),-1===h.search("Z")&&(i.z=1);p.scale.copy(this._scaleStart).multiply(i),this.scaleSnap&&(-1!==h.search("X")&&(p.scale.x=Math.round(p.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==h.search("Y")&&(p.scale.y=Math.round(p.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==h.search("Z")&&(p.scale.z=Math.round(p.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===l){this._offset.copy(this.pointEnd).sub(this.pointStart);const t=20/this.worldPosition.distanceTo(o.setFromMatrixPosition(this.camera.matrixWorld));let e=!1;"XYZE"===h?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(o.copy(this.rotationAxis).cross(this.eye))*t):"X"!==h&&"Y"!==h&&"Z"!==h||(this.rotationAxis.copy(s[h]),o.copy(s[h]),"local"===d&&o.applyQuaternion(this.worldQuaternion),o.cross(this.eye),0===o.length()?e=!0:this.rotationAngle=this._offset.dot(o.normalize())*t),("E"===h||e)&&(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),"local"===d&&"E"!==h&&"XYZE"!==h?(p.quaternion.copy(this._quaternionStart),p.quaternion.multiply(n.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),p.quaternion.copy(n.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),p.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(a),this.dispatchEvent(c)}}pointerUp(t){null!==t&&0!==t.button||(this.dragging&&null!==this.axis&&(h.mode=this.mode,this.dispatchEvent(h)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(t){return this.object=t,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,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(a),this.dispatchEvent(c),this.pointStart.copy(this.pointEnd))}getRaycaster(){return e}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}setColors(t,e,o,i){const n=this._gizmo.materialLib;n.xAxis.color.set(t),n.yAxis.color.set(e),n.zAxis.color.set(o),n.active.color.set(i),n.xAxisTransparent.color.set(t),n.yAxisTransparent.color.set(e),n.zAxisTransparent.color.set(o),n.activeTransparent.color.set(i),n.xAxis._color&&n.xAxis._color.set(t),n.yAxis._color&&n.yAxis._color.set(e),n.zAxis._color&&n.zAxis._color.set(o),n.active._color&&n.active._color.set(i),n.xAxisTransparent._color&&n.xAxisTransparent._color.set(t),n.yAxisTransparent._color&&n.yAxisTransparent._color.set(e),n.zAxisTransparent._color&&n.zAxisTransparent._color.set(o),n.activeTransparent._color&&n.activeTransparent._color.set(i)}}function p(t){if(this?.domElement){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};{const e=this.domElement.getBoundingClientRect();return{x:(t.clientX-e.left)/e.width*2-1,y:-(t.clientY-e.top)/e.height*2+1,button:t.button}}}}function d(t){if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(t))}}function m(t){this.enabled&&this.domElement&&(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(t)),this.pointerDown(this._getPointer(t)))}function u(t){this.enabled&&this.pointerMove(this._getPointer(t))}function y(t){this.enabled&&this.domElement&&(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(t)))}function w(t,e,o){const i=e.intersectObject(t,!0);for(let t=0;t<i.length;t++)if(i[t].object.visible||o)return i[t];return!1}const x=new t.Euler,M=new t.Vector3(0,1,0),b=new t.Vector3(0,0,0),_=new t.Matrix4,v=new t.Quaternion,g=new t.Quaternion,S=new t.Vector3,P=new t.Matrix4,f=new t.Vector3(1,0,0),E=new t.Vector3(0,1,0),A=new t.Vector3(0,0,1),Q=new t.Vector3,X=new t.Vector3,Y=new t.Vector3;class I extends t.Object3D{isTransformControlsRoot;controls;constructor(t){super(),this.isTransformControlsRoot=!0,this.controls=t,this.visible=!1}updateMatrixWorld(t){const e=this.controls;void 0!==e.object&&(e.object.updateMatrixWorld(),null===e.object.parent||e.object.parent.matrixWorld.decompose(e._parentPosition,e._parentQuaternion,e._parentScale),e.object.matrixWorld.decompose(e.worldPosition,e.worldQuaternion,e._worldScale),e._parentQuaternionInv.copy(e._parentQuaternion).invert(),e._worldQuaternionInv.copy(e.worldQuaternion).invert()),e.camera.updateMatrixWorld(),e.camera.matrixWorld.decompose(e.cameraPosition,e.cameraQuaternion,e._cameraScale),"isOrthographicCamera"in e.camera&&e.camera.isOrthographicCamera?e.camera.getWorldDirection(e.eye).negate():e.eye.copy(e.cameraPosition).sub(e.worldPosition).normalize(),super.updateMatrixWorld(t)}dispose(){this.traverse(function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}}class Z extends t.Object3D{type;constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=15418969,n=8834357,s=4098799,a=e.clone();a.opacity=.15;const r=o.clone();r.opacity=.5;const h=e.clone();h.color.setHex(i);const c=e.clone();c.color.setHex(n);const l=e.clone();l.color.setHex(s);const p=e.clone();p.color.setHex(i),p.opacity=.5;const d=e.clone();d.color.setHex(n),d.opacity=.5;const m=e.clone();m.color.setHex(s),m.opacity=.5;e.clone().opacity=.25;const u=e.clone();u.color.setHex(65501),u.opacity=.25;const y=e.clone();y.color.setHex(65501);e.clone().color.setHex(7895160),this.materialLib={xAxis:h,yAxis:c,zAxis:l,active:y,xAxisTransparent:p,yAxisTransparent:d,zAxisTransparent:m,activeTransparent:u};const w=.007,x=1.2*Math.PI,M=.05,b=new t.CylinderGeometry(0,.018,.065,32);b.translate(0,-.15,0);const _=new t.BoxGeometry(M,M,M);_.translate(0,-.15,0);const v=new t.BufferGeometry;v.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const g=new t.CylinderGeometry(w,w,.28,32);function S(e,o){const i=new t.TorusGeometry(e,w,3,64,x);return i.rotateY(Math.PI/2),i.rotateX(Math.PI/2),i}g.translate(0,.2,0);const P=.05,f={X:[[new t.Mesh(b,h),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(g,h),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(b,c),[0,.5,0]],[new t.Mesh(g,c)]],Z:[[new t.Mesh(b,l),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(g,l),null,[Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(P,P,.01),m),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(P,P,.01),p),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(P,P,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]]},E={X:[[new t.Mesh(b,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(g,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(b,a),[0,.5,0]],[new t.Mesh(g,a)]],Z:[[new t.Mesh(b,a),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(g,a),null,[Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(P,P,.01),a),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(P,P,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(P,P,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]]};new t.Mesh(new t.OctahedronGeometry(.01,2),r),new t.Mesh(new t.OctahedronGeometry(.01,2),r),new t.Line(function(){const e=new t.BufferGeometry;return e.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),e}(),r),new t.Line(v,r),new t.Line(v,r),Math.PI,new t.Line(v,r),Math.PI;const A=.2,Q={X:[[new t.Mesh(S(A),h)]],Y:[[new t.Mesh(S(A),c),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(S(A),l),null,[0,Math.PI/2,0]]]};new t.Line(v,r);const X={X:[[new t.Mesh(new t.TorusGeometry(A,w,4,24,x),a),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(A,w,4,24,x),a),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(A,w,4,24,x),a),[0,0,0],[0,0,-Math.PI/2]]]},Y={X:[[new t.Mesh(_,h),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(g,h),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(_,c),[0,.5,0]],[new t.Mesh(g,c)]],Z:[[new t.Mesh(_,l),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(g,l),[0,0,0],[Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(M,M,.01),m),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(M,M,.01),p),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(M,M,.01),d),[.15,0,.15],[-Math.PI/2,0,0]]]},I={X:[[new t.Mesh(_,h),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(g,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(_,c),[0,.5,0]],[new t.Mesh(g,a)]],Z:[[new t.Mesh(_,l),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(g,a),[0,0,0],[Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(M,M,.01),a),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(M,M,.01),a),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(M,M,.01),a),[.15,0,.15],[-Math.PI/2,0,0]]]};function Z(e){const o=new t.Object3D;for(const t in e)for(let i=e[t].length;i--;){const n=e[t][i][0].clone(),s=e[t][i][1],a=e[t][i][2],r=e[t][i][3],h=e[t][i][4];n.name=t,n.tag=h,s&&n.position.set(s[0],s[1],s[2]),a&&n.rotation.set(a[0],a[1],a[2]),r&&n.scale.set(r[0],r[1],r[2]),n.updateMatrix();const c=n.geometry.clone();c.applyMatrix4(n.matrix),n.geometry=c,n.renderOrder=1/0,n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),o.add(n)}return o}new t.Line(v,r),new t.Line(v,r),Math.PI,new t.Line(v,r),Math.PI,this.gizmo={},this.picker={},this.helper={},this.gizmo.rotate=Z(Q),this.add(this.gizmo.rotate),this.add(this.gizmo.translate=Z(f)),this.add(this.gizmo.scale=Z(Y)),this.add(this.picker.translate=Z(E)),this.add(this.picker.rotate=Z(X)),this.add(this.picker.scale=Z(I)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(t){const e="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:g;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode;let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children);for(let t=0;t<i.length;t++){const s=i[t];let a;if(s.visible=!0,s.rotation.set(0,0,0),s.position.copy(this.worldPosition),a=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),s.scale.set(1,1,1).multiplyScalar(a*this.size/4),"tag"in s&&"helper"===s.tag){s.visible=!1,"AXIS"===s.name?(s.visible=!!this.axis,"X"===this.axis&&(n.setFromEuler(x.set(0,0,0)),s.quaternion.copy(e).multiply(n),Math.abs(M.copy(f).applyQuaternion(e).dot(this.eye))>.9&&(s.visible=!1)),"Y"===this.axis&&(n.setFromEuler(x.set(0,0,Math.PI/2)),s.quaternion.copy(e).multiply(n),Math.abs(M.copy(E).applyQuaternion(e).dot(this.eye))>.9&&(s.visible=!1)),"Z"===this.axis&&(n.setFromEuler(x.set(0,Math.PI/2,0)),s.quaternion.copy(e).multiply(n),Math.abs(M.copy(A).applyQuaternion(e).dot(this.eye))>.9&&(s.visible=!1)),"XYZE"===this.axis&&(n.setFromEuler(x.set(0,Math.PI/2,0)),M.copy(this.rotationAxis),s.quaternion.setFromRotationMatrix(_.lookAt(b,M,E)),s.quaternion.multiply(n),s.visible=this.dragging),"E"===this.axis&&(s.visible=!1)):"START"===s.name?(s.position.copy(this.worldPositionStart),s.visible=this.dragging):"END"===s.name?(s.position.copy(this.worldPosition),s.visible=this.dragging):"DELTA"===s.name?(s.position.copy(this.worldPositionStart),s.quaternion.copy(this.worldQuaternionStart),o.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),o.applyQuaternion(this.worldQuaternionStart.clone().invert()),s.scale.copy(o),s.visible=this.dragging):(s.quaternion.copy(e),this.dragging?s.position.copy(this.worldPositionStart):s.position.copy(this.worldPosition),this.axis&&(s.visible=-1!==this.axis.search(s.name)));continue}if(s.quaternion.copy(e),"translate"===this.mode||"scale"===this.mode){const t=.99,o=.2;"X"===s.name&&Math.abs(M.copy(f).applyQuaternion(e).dot(this.eye))>t&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"Y"===s.name&&Math.abs(M.copy(E).applyQuaternion(e).dot(this.eye))>t&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"Z"===s.name&&Math.abs(M.copy(A).applyQuaternion(e).dot(this.eye))>t&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"XY"===s.name&&Math.abs(M.copy(A).applyQuaternion(e).dot(this.eye))<o&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"YZ"===s.name&&Math.abs(M.copy(f).applyQuaternion(e).dot(this.eye))<o&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1),"XZ"===s.name&&Math.abs(M.copy(E).applyQuaternion(e).dot(this.eye))<o&&(s.scale.set(1e-10,1e-10,1e-10),s.visible=!1)}else"rotate"===this.mode&&(v.copy(e),M.copy(this.eye).applyQuaternion(n.copy(e).invert()),-1!==s.name.search("E")&&s.quaternion.setFromRotationMatrix(_.lookAt(this.eye,b,E)),"X"===s.name&&(n.setFromAxisAngle(f,Math.atan2(-M.y,M.z)),n.multiplyQuaternions(v,n),s.quaternion.copy(n)),"Y"===s.name&&(n.setFromAxisAngle(E,Math.atan2(M.x,M.z)),n.multiplyQuaternions(v,n),s.quaternion.copy(n)),"Z"===s.name&&(n.setFromAxisAngle(A,Math.atan2(M.y,M.x)),n.multiplyQuaternions(v,n),s.quaternion.copy(n)));s.visible=s.visible&&(-1===s.name.indexOf("X")||this.showX),s.visible=s.visible&&(-1===s.name.indexOf("Y")||this.showY),s.visible=s.visible&&(-1===s.name.indexOf("Z")||this.showZ),s.visible=s.visible&&(-1===s.name.indexOf("E")||this.showX&&this.showY&&this.showZ);const r=s.material;r._color=r._color||r.color.clone(),r._opacity=r._opacity||r.opacity,r.color.copy(r._color),r.opacity=r._opacity,this.enabled&&this.axis&&(s.name===this.axis||this.axis.split("").some(function(t){return s.name===t}))&&(r.color.copy(this.materialLib.active.color),r.opacity=1)}super.updateMatrixWorld(t)}}class z extends t.Mesh{type="";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(t){let e=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),Q.copy(f).applyQuaternion("local"===e?this.worldQuaternion:g),X.copy(E).applyQuaternion("local"===e?this.worldQuaternion:g),Y.copy(A).applyQuaternion("local"===e?this.worldQuaternion:g),M.copy(X),this.mode){case"translate":case"scale":switch(this.axis){case"X":M.copy(this.eye).cross(Q),S.copy(Q).cross(M);break;case"Y":M.copy(this.eye).cross(X),S.copy(X).cross(M);break;case"Z":M.copy(this.eye).cross(Y),S.copy(Y).cross(M);break;case"XY":S.copy(Y);break;case"YZ":S.copy(Q);break;case"XZ":M.copy(Y),S.copy(X);break;case"XYZ":case"E":S.set(0,0,0)}break;default:S.set(0,0,0)}0===S.length()?this.quaternion.copy(this.cameraQuaternion):(P.lookAt(o.set(0,0,0),S,M),this.quaternion.setFromRotationMatrix(P)),super.updateMatrixWorld(t)}}exports.TTControls=l,exports.TransformControlsGizmo=Z,exports.TransformControlsPlane=z;
@@ -0,0 +1 @@
1
+ import"../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{Raycaster as t,Vector3 as e,Matrix4 as i,Controls as o,Quaternion as n,Vector2 as s,Object3D as a,MeshBasicMaterial as r,LineBasicMaterial as h,CylinderGeometry as l,BoxGeometry as c,BufferGeometry as p,Float32BufferAttribute as d,Mesh as m,Line as u,OctahedronGeometry as w,TorusGeometry as y,Euler as x,PlaneGeometry as _,DoubleSide as b}from"../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const v=new t,g=new e,M=new e,S=new n,P={X:new e(1,0,0),Y:new e(0,1,0),Z:new e(0,0,1)},f={type:"change"},E={type:"mouseDown",mode:null},A={type:"mouseUp",mode:null},X={type:"objectChange"};class Y extends o{camera;axis;mode;translationSnap;rotationSnap;scaleSnap;space;size;dragging;showX;showY;showZ;minx;maxX;minY;maxY;minZ;maxZ;_root;_gizmo;_plane;constructor(t,i=null){super(t,i);const o=new J(this);this._root=o;const s=new K;this._gizmo=s,o.add(s);const a=new V;this._plane=a,o.add(a);const r=this;function h(t,e){let i=e;Object.defineProperty(r,t,{get:function(){return void 0!==i?i:e},set:function(e){i!==e&&(i=e,a[t]=e,s[t]=e,r.dispatchEvent({type:t+"-changed",value:e}),r.dispatchEvent(f))}}),r[t]=e,a[t]=e,s[t]=e}h("camera",t),h("object",void 0),h("enabled",!0),h("axis",null),h("mode","translate"),h("translationSnap",null),h("rotationSnap",null),h("scaleSnap",null),h("space","world"),h("size",1),h("dragging",!1),h("showX",!0),h("showY",!0),h("showZ",!0),h("minX",-1/0),h("maxX",1/0),h("minY",-1/0),h("maxY",1/0),h("minZ",-1/0),h("maxZ",1/0);const l=new e,c=new e,p=new n,d=new n,m=new e,u=new n,w=new e,y=new e,x=new e,_=new e;h("worldPosition",l),h("worldPositionStart",c),h("worldQuaternion",p),h("worldQuaternionStart",d),h("cameraPosition",m),h("cameraQuaternion",u),h("pointStart",w),h("pointEnd",y),h("rotationAxis",x),h("rotationAngle",0),h("eye",_),this._offset=new e,this._startNorm=new e,this._endNorm=new e,this._cameraScale=new e,this._parentPosition=new e,this._parentQuaternion=new n,this._parentQuaternionInv=new n,this._parentScale=new e,this._worldScaleStart=new e,this._worldQuaternionInv=new n,this._worldScale=new e,this._positionStart=new e,this._quaternionStart=new n,this._scaleStart=new e,this._getPointer=I.bind(this),this._onPointerDown=Z.bind(this),this._onPointerHover=Q.bind(this),this._onPointerMove=z.bind(this),this._onPointerUp=T.bind(this),null!==i&&this.connect(i)}connect(t){super.connect(t),this.domElement&&(this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none")}disconnect(){this.domElement&&(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.domElement.style.touchAction="auto")}getHelper(){return this._root}pointerHover(t){if(void 0===this.object||!0===this.dragging)return;null!==t&&v.setFromCamera(t,this.camera);const e=q(this._gizmo.picker[this.mode],v);e?(this.axis=e.object.name,this.showX=-1!==this.axis.search("X"),this.showY=-1!==this.axis.search("Y"),this.showZ=-1!==this.axis.search("Z")):(this.showX=this.showY=this.showZ=!0,this.axis=null)}pointerDown(t){if(void 0!==this.object&&!0!==this.dragging&&(null==t||0===t.button)&&null!==this.axis){null!==t&&v.setFromCamera(new s(t.x,t.y),this.camera);const e=q(this._plane,v,!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,E.mode=this.mode,this.dispatchEvent(E)}}pointerMove(t){const e=this.axis,i=this.mode,o=this.object;let n=this.space;if("scale"===i?n="local":"E"!==e&&"XYZE"!==e&&"XYZ"!==e||(n="world"),void 0===o||null===e||!1===this.dragging||null!==t&&-1!==t.button)return;null!==t&&v.setFromCamera(new s(t.x,t.y),this.camera);const a=q(this._plane,v,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),"translate"===i)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===n&&"XYZ"!==e&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===e.indexOf("X")&&(this._offset.x=0),-1===e.indexOf("Y")&&(this._offset.y=0),-1===e.indexOf("Z")&&(this._offset.z=0),"local"===n&&"XYZ"!==e?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),o.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===n&&(o.position.applyQuaternion(S.copy(this._quaternionStart).invert()),-1!==e.search("X")&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.position.applyQuaternion(this._quaternionStart)),"world"===n&&(o.parent&&o.position.add(g.setFromMatrixPosition(o.parent.matrixWorld)),-1!==e.search("X")&&(o.position.x=Math.round(o.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(o.position.y=Math.round(o.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(o.position.z=Math.round(o.position.z/this.translationSnap)*this.translationSnap),o.parent&&o.position.sub(g.setFromMatrixPosition(o.parent.matrixWorld)))),o.position.x=Math.max(this.minX,Math.min(this.maxX,o.position.x)),o.position.y=Math.max(this.minY,Math.min(this.maxY,o.position.y)),o.position.z=Math.max(this.minZ,Math.min(this.maxZ,o.position.z));else if("scale"===i){if(-1!==e.search("XYZ")){let t=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(t*=-1),M.set(t,t,t)}else g.copy(this.pointStart),M.copy(this.pointEnd),g.applyQuaternion(this._worldQuaternionInv),M.applyQuaternion(this._worldQuaternionInv),M.divide(g),-1===e.search("X")&&(M.x=1),-1===e.search("Y")&&(M.y=1),-1===e.search("Z")&&(M.z=1);o.scale.copy(this._scaleStart).multiply(M),this.scaleSnap&&(-1!==e.search("X")&&(o.scale.x=Math.round(o.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Y")&&(o.scale.y=Math.round(o.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Z")&&(o.scale.z=Math.round(o.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===i){this._offset.copy(this.pointEnd).sub(this.pointStart);const t=20/this.worldPosition.distanceTo(g.setFromMatrixPosition(this.camera.matrixWorld));let i=!1;"XYZE"===e?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(g.copy(this.rotationAxis).cross(this.eye))*t):"X"!==e&&"Y"!==e&&"Z"!==e||(this.rotationAxis.copy(P[e]),g.copy(P[e]),"local"===n&&g.applyQuaternion(this.worldQuaternion),g.cross(this.eye),0===g.length()?i=!0:this.rotationAngle=this._offset.dot(g.normalize())*t),("E"===e||i)&&(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),"local"===n&&"E"!==e&&"XYZE"!==e?(o.quaternion.copy(this._quaternionStart),o.quaternion.multiply(S.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),o.quaternion.copy(S.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),o.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(f),this.dispatchEvent(X)}}pointerUp(t){null!==t&&0!==t.button||(this.dragging&&null!==this.axis&&(A.mode=this.mode,this.dispatchEvent(A)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(t){return this.object=t,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,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(X),this.pointStart.copy(this.pointEnd))}getRaycaster(){return v}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}setColors(t,e,i,o){const n=this._gizmo.materialLib;n.xAxis.color.set(t),n.yAxis.color.set(e),n.zAxis.color.set(i),n.active.color.set(o),n.xAxisTransparent.color.set(t),n.yAxisTransparent.color.set(e),n.zAxisTransparent.color.set(i),n.activeTransparent.color.set(o),n.xAxis._color&&n.xAxis._color.set(t),n.yAxis._color&&n.yAxis._color.set(e),n.zAxis._color&&n.zAxis._color.set(i),n.active._color&&n.active._color.set(o),n.xAxisTransparent._color&&n.xAxisTransparent._color.set(t),n.yAxisTransparent._color&&n.yAxisTransparent._color.set(e),n.zAxisTransparent._color&&n.zAxisTransparent._color.set(i),n.activeTransparent._color&&n.activeTransparent._color.set(o)}}function I(t){if(this?.domElement){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};{const e=this.domElement.getBoundingClientRect();return{x:(t.clientX-e.left)/e.width*2-1,y:-(t.clientY-e.top)/e.height*2+1,button:t.button}}}}function Q(t){if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(t))}}function Z(t){this.enabled&&this.domElement&&(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(t)),this.pointerDown(this._getPointer(t)))}function z(t){this.enabled&&this.pointerMove(this._getPointer(t))}function T(t){this.enabled&&this.domElement&&(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(t)))}function q(t,e,i){const o=e.intersectObject(t,!0);for(let t=0;t<o.length;t++)if(o[t].object.visible||i)return o[t];return!1}const j=new x,k=new e(0,1,0),W=new e(0,0,0),F=new i,C=new n,H=new n,L=new e,O=new i,D=new e(1,0,0),R=new e(0,1,0),N=new e(0,0,1),U=new e,G=new e,B=new e;class J extends a{isTransformControlsRoot;controls;constructor(t){super(),this.isTransformControlsRoot=!0,this.controls=t,this.visible=!1}updateMatrixWorld(t){const e=this.controls;void 0!==e.object&&(e.object.updateMatrixWorld(),null===e.object.parent||e.object.parent.matrixWorld.decompose(e._parentPosition,e._parentQuaternion,e._parentScale),e.object.matrixWorld.decompose(e.worldPosition,e.worldQuaternion,e._worldScale),e._parentQuaternionInv.copy(e._parentQuaternion).invert(),e._worldQuaternionInv.copy(e.worldQuaternion).invert()),e.camera.updateMatrixWorld(),e.camera.matrixWorld.decompose(e.cameraPosition,e.cameraQuaternion,e._cameraScale),"isOrthographicCamera"in e.camera&&e.camera.isOrthographicCamera?e.camera.getWorldDirection(e.eye).negate():e.eye.copy(e.cameraPosition).sub(e.worldPosition).normalize(),super.updateMatrixWorld(t)}dispose(){this.traverse(function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}}class K extends a{type;constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const t=new r({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new h({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=15418969,o=8834357,n=4098799,s=t.clone();s.opacity=.15;const x=e.clone();x.opacity=.5;const _=t.clone();_.color.setHex(i);const b=t.clone();b.color.setHex(o);const v=t.clone();v.color.setHex(n);const g=t.clone();g.color.setHex(i),g.opacity=.5;const M=t.clone();M.color.setHex(o),M.opacity=.5;const S=t.clone();S.color.setHex(n),S.opacity=.5;t.clone().opacity=.25;const P=t.clone();P.color.setHex(65501),P.opacity=.25;const f=t.clone();f.color.setHex(65501);t.clone().color.setHex(7895160),this.materialLib={xAxis:_,yAxis:b,zAxis:v,active:f,xAxisTransparent:g,yAxisTransparent:M,zAxisTransparent:S,activeTransparent:P};const E=.007,A=1.2*Math.PI,X=.05,Y=new l(0,.018,.065,32);Y.translate(0,-.15,0);const I=new c(X,X,X);I.translate(0,-.15,0);const Q=new p;Q.setAttribute("position",new d([0,0,0,1,0,0],3));const Z=new l(E,E,.28,32);function z(t,e){const i=new y(t,E,3,64,A);return i.rotateY(Math.PI/2),i.rotateX(Math.PI/2),i}Z.translate(0,.2,0);const T=.05,q={X:[[new m(Y,_),[.5,0,0],[0,0,-Math.PI/2]],[new m(Z,_),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new m(Y,b),[0,.5,0]],[new m(Z,b)]],Z:[[new m(Y,v),[0,0,.5],[Math.PI/2,0,0]],[new m(Z,v),null,[Math.PI/2,0,0]]],XY:[[new m(new c(T,T,.01),S),[.15,.15,0]]],YZ:[[new m(new c(T,T,.01),g),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new m(new c(T,T,.01),M),[.15,0,.15],[-Math.PI/2,0,0]]]},j={X:[[new m(Y,s),[.5,0,0],[0,0,-Math.PI/2]],[new m(Z,s),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new m(Y,s),[0,.5,0]],[new m(Z,s)]],Z:[[new m(Y,s),[0,0,.5],[Math.PI/2,0,0]],[new m(Z,s),null,[Math.PI/2,0,0]]],XY:[[new m(new c(T,T,.01),s),[.15,.15,0]]],YZ:[[new m(new c(T,T,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new m(new c(T,T,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]};new m(new w(.01,2),x),new m(new w(.01,2),x),new u(function(){const t=new p;return t.setAttribute("position",new d([0,0,0,1,1,1],3)),t}(),x),new u(Q,x),new u(Q,x),Math.PI,new u(Q,x),Math.PI;const k=.2,W={X:[[new m(z(k),_)]],Y:[[new m(z(k),b),null,[0,0,-Math.PI/2]]],Z:[[new m(z(k),v),null,[0,Math.PI/2,0]]]};new u(Q,x);const F={X:[[new m(new y(k,E,4,24,A),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new m(new y(k,E,4,24,A),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new m(new y(k,E,4,24,A),s),[0,0,0],[0,0,-Math.PI/2]]]},C={X:[[new m(I,_),[.5,0,0],[0,0,-Math.PI/2]],[new m(Z,_),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new m(I,b),[0,.5,0]],[new m(Z,b)]],Z:[[new m(I,v),[0,0,.5],[Math.PI/2,0,0]],[new m(Z,v),[0,0,0],[Math.PI/2,0,0]]],XY:[[new m(new c(X,X,.01),S),[.15,.15,0]]],YZ:[[new m(new c(X,X,.01),g),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new m(new c(X,X,.01),M),[.15,0,.15],[-Math.PI/2,0,0]]]},H={X:[[new m(I,_),[.5,0,0],[0,0,-Math.PI/2]],[new m(Z,s),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new m(I,b),[0,.5,0]],[new m(Z,s)]],Z:[[new m(I,v),[0,0,.5],[Math.PI/2,0,0]],[new m(Z,s),[0,0,0],[Math.PI/2,0,0]]],XY:[[new m(new c(X,X,.01),s),[.15,.15,0]]],YZ:[[new m(new c(X,X,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new m(new c(X,X,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]};function L(t){const e=new a;for(const i in t)for(let o=t[i].length;o--;){const n=t[i][o][0].clone(),s=t[i][o][1],a=t[i][o][2],r=t[i][o][3],h=t[i][o][4];n.name=i,n.tag=h,s&&n.position.set(s[0],s[1],s[2]),a&&n.rotation.set(a[0],a[1],a[2]),r&&n.scale.set(r[0],r[1],r[2]),n.updateMatrix();const l=n.geometry.clone();l.applyMatrix4(n.matrix),n.geometry=l,n.renderOrder=1/0,n.position.set(0,0,0),n.rotation.set(0,0,0),n.scale.set(1,1,1),e.add(n)}return e}new u(Q,x),new u(Q,x),Math.PI,new u(Q,x),Math.PI,this.gizmo={},this.picker={},this.helper={},this.gizmo.rotate=L(W),this.add(this.gizmo.rotate),this.add(this.gizmo.translate=L(q)),this.add(this.gizmo.scale=L(C)),this.add(this.picker.translate=L(j)),this.add(this.picker.rotate=L(F)),this.add(this.picker.scale=L(H)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(t){const e="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:H;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode;let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children);for(let t=0;t<i.length;t++){const o=i[t];let n;if(o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition),n=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),o.scale.set(1,1,1).multiplyScalar(n*this.size/4),"tag"in o&&"helper"===o.tag){o.visible=!1,"AXIS"===o.name?(o.visible=!!this.axis,"X"===this.axis&&(S.setFromEuler(j.set(0,0,0)),o.quaternion.copy(e).multiply(S),Math.abs(k.copy(D).applyQuaternion(e).dot(this.eye))>.9&&(o.visible=!1)),"Y"===this.axis&&(S.setFromEuler(j.set(0,0,Math.PI/2)),o.quaternion.copy(e).multiply(S),Math.abs(k.copy(R).applyQuaternion(e).dot(this.eye))>.9&&(o.visible=!1)),"Z"===this.axis&&(S.setFromEuler(j.set(0,Math.PI/2,0)),o.quaternion.copy(e).multiply(S),Math.abs(k.copy(N).applyQuaternion(e).dot(this.eye))>.9&&(o.visible=!1)),"XYZE"===this.axis&&(S.setFromEuler(j.set(0,Math.PI/2,0)),k.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(F.lookAt(W,k,R)),o.quaternion.multiply(S),o.visible=this.dragging),"E"===this.axis&&(o.visible=!1)):"START"===o.name?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):"END"===o.name?(o.position.copy(this.worldPosition),o.visible=this.dragging):"DELTA"===o.name?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),g.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),g.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(g),o.visible=this.dragging):(o.quaternion.copy(e),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=-1!==this.axis.search(o.name)));continue}if(o.quaternion.copy(e),"translate"===this.mode||"scale"===this.mode){const t=.99,i=.2;"X"===o.name&&Math.abs(k.copy(D).applyQuaternion(e).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"Y"===o.name&&Math.abs(k.copy(R).applyQuaternion(e).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"Z"===o.name&&Math.abs(k.copy(N).applyQuaternion(e).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"XY"===o.name&&Math.abs(k.copy(N).applyQuaternion(e).dot(this.eye))<i&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"YZ"===o.name&&Math.abs(k.copy(D).applyQuaternion(e).dot(this.eye))<i&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"XZ"===o.name&&Math.abs(k.copy(R).applyQuaternion(e).dot(this.eye))<i&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)}else"rotate"===this.mode&&(C.copy(e),k.copy(this.eye).applyQuaternion(S.copy(e).invert()),-1!==o.name.search("E")&&o.quaternion.setFromRotationMatrix(F.lookAt(this.eye,W,R)),"X"===o.name&&(S.setFromAxisAngle(D,Math.atan2(-k.y,k.z)),S.multiplyQuaternions(C,S),o.quaternion.copy(S)),"Y"===o.name&&(S.setFromAxisAngle(R,Math.atan2(k.x,k.z)),S.multiplyQuaternions(C,S),o.quaternion.copy(S)),"Z"===o.name&&(S.setFromAxisAngle(N,Math.atan2(k.y,k.x)),S.multiplyQuaternions(C,S),o.quaternion.copy(S)));o.visible=o.visible&&(-1===o.name.indexOf("X")||this.showX),o.visible=o.visible&&(-1===o.name.indexOf("Y")||this.showY),o.visible=o.visible&&(-1===o.name.indexOf("Z")||this.showZ),o.visible=o.visible&&(-1===o.name.indexOf("E")||this.showX&&this.showY&&this.showZ);const s=o.material;s._color=s._color||s.color.clone(),s._opacity=s._opacity||s.opacity,s.color.copy(s._color),s.opacity=s._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(t){return o.name===t}))&&(s.color.copy(this.materialLib.active.color),s.opacity=1)}super.updateMatrixWorld(t)}}class V extends m{type="";constructor(){super(new _(1e5,1e5,2,2),new r({visible:!1,wireframe:!0,side:b,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),U.copy(D).applyQuaternion("local"===e?this.worldQuaternion:H),G.copy(R).applyQuaternion("local"===e?this.worldQuaternion:H),B.copy(N).applyQuaternion("local"===e?this.worldQuaternion:H),k.copy(G),this.mode){case"translate":case"scale":switch(this.axis){case"X":k.copy(this.eye).cross(U),L.copy(U).cross(k);break;case"Y":k.copy(this.eye).cross(G),L.copy(G).cross(k);break;case"Z":k.copy(this.eye).cross(B),L.copy(B).cross(k);break;case"XY":L.copy(B);break;case"YZ":L.copy(U);break;case"XZ":k.copy(B),L.copy(G);break;case"XYZ":case"E":L.set(0,0,0)}break;default:L.set(0,0,0)}0===L.length()?this.quaternion.copy(this.cameraQuaternion):(O.lookAt(g.set(0,0,0),L,k),this.quaternion.setFromRotationMatrix(O)),super.updateMatrixWorld(t)}}export{Y as TTControls,K as TransformControlsGizmo,V as TransformControlsPlane};
@@ -1 +1 @@
1
- "use strict";var e,r=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/OrbitControls.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/TrackballControls.cjs.js"),t=require("./controlsLibs/FirstControls.cjs.js"),n=require("../../utils/Logger.cjs.js"),s=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");exports.CONTROL_TYPE=void 0,(e=exports.CONTROL_TYPE||(exports.CONTROL_TYPE={}))[e.ORBIT=0]="ORBIT",e[e.TRACKBALL=1]="TRACKBALL",e[e.FIRSTPERSON=2]="FIRSTPERSON";const i=new Map([[exports.CONTROL_TYPE.ORBIT,r.OrbitControls],[exports.CONTROL_TYPE.TRACKBALL,o.TrackballControls],[exports.CONTROL_TYPE.FIRSTPERSON,t.FirstControls]]);exports.ControlsManager=class{engine;CONTROL_TYPE;constructor(e){this.CONTROL_TYPE=exports.CONTROL_TYPE,this.engine=e}createControls(e=0,r,o){if(o instanceof HTMLElement){if(r instanceof s.Camera)return i.has(e)?(exports.CONTROL_TYPE.ORBIT,this.initOrbitControls(r,o)):(n.Logger.warn("ControlManager","Control type is not defined , default to OrbitControls"),new(i.get(exports.CONTROL_TYPE.ORBIT))(r,o));n.Logger.error("ControlManager","Camera is not defined")}else n.Logger.error("ControlManager","DomElement is not defined")}initOrbitControls(e,o){const t=new r.OrbitControls(e,o);return t.enableDamping=!0,t.dampingFactor=.85,t.screenSpacePanning=!1,t}initFirstpersonControls(e,r){const o=new t.FirstControls(e,r);return o.pointerSpeed=.05,r.addEventListener("click",()=>o.lock()),o}initTrackballControls(e,r){return new o.TrackballControls(e,r)}};
1
+ "use strict";var e,r=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/OrbitControls.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/TrackballControls.cjs.js"),t=require("./controlsLibs/FirstControls.cjs.js"),n=require("../../utils/Logger.cjs.js"),s=require("./TTControls/TTControls.cjs.js"),l=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");exports.CONTROL_TYPE=void 0,(e=exports.CONTROL_TYPE||(exports.CONTROL_TYPE={}))[e.ORBIT=0]="ORBIT",e[e.TRACKBALL=1]="TRACKBALL",e[e.FIRSTPERSON=2]="FIRSTPERSON";const i=new Map([[exports.CONTROL_TYPE.ORBIT,r.OrbitControls],[exports.CONTROL_TYPE.TRACKBALL,o.TrackballControls],[exports.CONTROL_TYPE.FIRSTPERSON,t.FirstControls]]);exports.TTControls=s.TTControls,exports.ControlsManager=class{engine;CONTROL_TYPE;constructor(e){this.CONTROL_TYPE=exports.CONTROL_TYPE,this.engine=e}createControls(e=0,r,o){if(o instanceof HTMLElement){if(r instanceof l.Camera)return i.has(e)?(exports.CONTROL_TYPE.ORBIT,this.initOrbitControls(r,o)):(n.Logger.warn("ControlManager","Control type is not defined , default to OrbitControls"),new(i.get(exports.CONTROL_TYPE.ORBIT))(r,o));n.Logger.error("ControlManager","Camera is not defined")}else n.Logger.error("ControlManager","DomElement is not defined")}initOrbitControls(e,o){const t=new r.OrbitControls(e,o);return t.enableDamping=!0,t.dampingFactor=.85,t.screenSpacePanning=!1,t}initFirstpersonControls(e,r){const o=new t.FirstControls(e,r);return o.pointerSpeed=.05,r.addEventListener("click",()=>o.lock()),o}initTrackballControls(e,r){return new o.TrackballControls(e,r)}};
@@ -1 +1 @@
1
- import{OrbitControls as e}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/OrbitControls.esm.js";import{TrackballControls as o}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/TrackballControls.esm.js";import{FirstControls as n}from"./controlsLibs/FirstControls.esm.js";import{Logger as r}from"../../utils/Logger.esm.js";import{Camera as t}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";var s;!function(e){e[e.ORBIT=0]="ORBIT",e[e.TRACKBALL=1]="TRACKBALL",e[e.FIRSTPERSON=2]="FIRSTPERSON"}(s||(s={}));const i=new Map([[s.ORBIT,e],[s.TRACKBALL,o],[s.FIRSTPERSON,n]]);class l{engine;CONTROL_TYPE;constructor(e){this.CONTROL_TYPE=s,this.engine=e}createControls(e=0,o,n){if(n instanceof HTMLElement){if(o instanceof t)return i.has(e)?(s.ORBIT,this.initOrbitControls(o,n)):(r.warn("ControlManager","Control type is not defined , default to OrbitControls"),new(i.get(s.ORBIT))(o,n));r.error("ControlManager","Camera is not defined")}else r.error("ControlManager","DomElement is not defined")}initOrbitControls(o,n){const r=new e(o,n);return r.enableDamping=!0,r.dampingFactor=.85,r.screenSpacePanning=!1,r}initFirstpersonControls(e,o){const r=new n(e,o);return r.pointerSpeed=.05,o.addEventListener("click",()=>r.lock()),r}initTrackballControls(e,n){return new o(e,n)}}export{s as CONTROL_TYPE,l as ControlsManager};
1
+ import{OrbitControls as e}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/OrbitControls.esm.js";import{TrackballControls as o}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/controls/TrackballControls.esm.js";import{FirstControls as n}from"./controlsLibs/FirstControls.esm.js";import{Logger as r}from"../../utils/Logger.esm.js";export{TTControls}from"./TTControls/TTControls.esm.js";import{Camera as t}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";var s;!function(e){e[e.ORBIT=0]="ORBIT",e[e.TRACKBALL=1]="TRACKBALL",e[e.FIRSTPERSON=2]="FIRSTPERSON"}(s||(s={}));const i=new Map([[s.ORBIT,e],[s.TRACKBALL,o],[s.FIRSTPERSON,n]]);class l{engine;CONTROL_TYPE;constructor(e){this.CONTROL_TYPE=s,this.engine=e}createControls(e=0,o,n){if(n instanceof HTMLElement){if(o instanceof t)return i.has(e)?(s.ORBIT,this.initOrbitControls(o,n)):(r.warn("ControlManager","Control type is not defined , default to OrbitControls"),new(i.get(s.ORBIT))(o,n));r.error("ControlManager","Camera is not defined")}else r.error("ControlManager","DomElement is not defined")}initOrbitControls(o,n){const r=new e(o,n);return r.enableDamping=!0,r.dampingFactor=.85,r.screenSpacePanning=!1,r}initFirstpersonControls(e,o){const r=new n(e,o);return r.pointerSpeed=.05,o.addEventListener("click",()=>r.lock()),r}initTrackballControls(e,n){return new o(e,n)}}export{s as CONTROL_TYPE,l as ControlsManager};
@@ -1 +1 @@
1
- "use strict";var e=require("./extrudeMap.cjs.js");const t={steps:1,depth:.18,bevelEnabled:!1};exports.PotatoMap=class{constructor(){}static createExtrudeMap(r,s=t){return e.createExtrudeMap(r,s)}};
1
+ "use strict";var t=require("./ExtrudeMap.cjs.js");const e={steps:1,depth:.18,bevelEnabled:!1};exports.PotatoMap=class{constructor(){}static createExtrudeMap(r,s=e){return t.createExtrudeMap(r,s)}};
@@ -1 +1 @@
1
- import{createExtrudeMap as e}from"./extrudeMap.esm.js";const t={steps:1,depth:.18,bevelEnabled:!1};class r{constructor(){}static createExtrudeMap(r,s=t){return e(r,s)}}export{r as PotatoMap};
1
+ import{createExtrudeMap as t}from"./ExtrudeMap.esm.js";const e={steps:1,depth:.18,bevelEnabled:!1};class r{constructor(){}static createExtrudeMap(r,s=e){return t(r,s)}}export{r as PotatoMap};
@@ -1 +1 @@
1
- "use strict";var e=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/renderers/CSS3DRenderer.cjs.js");require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js");var n=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");exports.MarkerHtmlUI=class{engine;css3dRenderer;box3=new n.Box3;isRender=!1;constructor(e){this.engine=e,this.initCSS3DRenderer()}initCSS3DRenderer(){this.isRender=!0;const{clientWidth:n,clientHeight:t}=this.engine.container;this.css3dRenderer=new e.CSS3DRenderer,this.css3dRenderer.setSize(n,t),this.css3dRenderer.domElement.style.position="absolute",this.css3dRenderer.domElement.style.top="0px",this.css3dRenderer.domElement.style.left="0px",this.css3dRenderer.domElement.style.pointerEvents="none",this.engine.container.appendChild(this.css3dRenderer.domElement),this.startRender()}render(){this.isRender&&this.css3dRenderer.render(this.engine.sceneGraph,this.engine.camera)}stopRender(){this.isRender=!1}startRender(){this.isRender=!0}createMarker(t,s,r="标题",i=.02,o="marker-body"){const d=document.createElement("div");d.style.fontSize="8px",d.classList.add(o);let l="";for(const e in s)l+=`<div style="disply: flex;flex-direction:column;margin-top: 0px;">\n <span style="font-family: '思源黑体'; color: rgb(177, 195, 212);font-size: 0.8rem;">${e}: </span>\n <span style="font-family: 'DINPRO-Bold';font-weight: 700; color: rgb(255, 255, 255);font-size: 1rem;">${s[e].value}</span>\n <span style="font-family: '微软雅黑';font-weight: 500; color: rgba(255, 255, 255, 0.7);font-size: 0.8rem;">${s[e].unit}</span>\n </div>`;const c=`\n <div style="font-size: 1rem;color: #fff;disply: flex:direction:column;align-items:center;">\n <span class="ui-button" style="font-family: 'DINPRO'; font-weight: 700; color: rgb(255, 255, 255);" >${r}</span>\n ${l}\n </div>\n `;d.innerHTML=c;const m=new e.CSS3DSprite(d);m.element.style.pointerEvents="none",m.scale.setScalar(i);const a=this.box3.setFromObject(t),h=new n.Vector3,p=new n.Vector3;a.getCenter(h),a.getSize(p);const f=t.getWorldPosition(new n.Vector3),{x:u,y:R,z:y}=f;return m.position.set(u,R+.005,y),m.name=s.name,m}};
1
+ "use strict";var e=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/renderers/CSS3DRenderer.cjs.js");require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js");var n=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");exports.MarkerHtmlUI=class{engine;css3dRenderer;box3=new n.Box3;isRender=!1;constructor(e){this.engine=e,this.initCSS3DRenderer()}initCSS3DRenderer(){this.isRender=!0;const{clientWidth:n,clientHeight:t}=this.engine.container;this.css3dRenderer=new e.CSS3DRenderer,this.css3dRenderer.setSize(n,t),this.css3dRenderer.domElement.style.position="absolute",this.css3dRenderer.domElement.style.top="0px",this.css3dRenderer.domElement.style.left="0px",this.css3dRenderer.domElement.style.borderRadius="6px",this.css3dRenderer.domElement.style.pointerEvents="none",this.engine.container.appendChild(this.css3dRenderer.domElement),this.startRender()}render(){this.isRender&&this.css3dRenderer.render(this.engine.sceneGraph,this.engine.camera)}stopRender(){this.isRender=!1}startRender(){this.isRender=!0}createMarker(t,s,r="标题",i=.02,o="marker-body"){const d=document.createElement("div");d.style.fontSize="8px",d.classList.add(o);let l="";for(const e in s)l+=`<div style="disply: flex;flex-direction:column;margin-top: 0px;">\n <span style="font-family: '思源黑体'; color: rgb(177, 195, 212);font-size: 0.8rem;">${e}: </span>\n <span style="font-family: 'DINPRO-Bold';font-weight: 700; color: rgb(255, 255, 255);font-size: 1rem;">${s[e].value}</span>\n <span style="font-family: '微软雅黑';font-weight: 500; color: rgba(255, 255, 255, 0.7);font-size: 0.8rem;">${s[e].unit}</span>\n </div>`;const c=`\n <div style="font-size: 1rem;color: #fff;disply: flex:direction:column;align-items:center;">\n <span class="ui-button" style="font-family: 'DINPRO'; font-weight: 700; color: rgb(255, 255, 255);" >${r}</span>\n ${l}\n </div>\n `;d.innerHTML=c;const m=new e.CSS3DSprite(d);m.element.style.pointerEvents="none",m.scale.setScalar(i);const a=this.box3.setFromObject(t),h=new n.Vector3,p=new n.Vector3;a.getCenter(h),a.getSize(p);const R=t.getWorldPosition(new n.Vector3),{x:f,y:u,z:y}=R;return m.position.set(f,u+.005,y),m.name=s.name,m}};
@@ -1 +1 @@
1
- import{CSS3DRenderer as e,CSS3DSprite as n}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/renderers/CSS3DRenderer.esm.js";import"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{Box3 as t,Vector3 as s}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class r{engine;css3dRenderer;box3=new t;isRender=!1;constructor(e){this.engine=e,this.initCSS3DRenderer()}initCSS3DRenderer(){this.isRender=!0;const{clientWidth:n,clientHeight:t}=this.engine.container;this.css3dRenderer=new e,this.css3dRenderer.setSize(n,t),this.css3dRenderer.domElement.style.position="absolute",this.css3dRenderer.domElement.style.top="0px",this.css3dRenderer.domElement.style.left="0px",this.css3dRenderer.domElement.style.pointerEvents="none",this.engine.container.appendChild(this.css3dRenderer.domElement),this.startRender()}render(){this.isRender&&this.css3dRenderer.render(this.engine.sceneGraph,this.engine.camera)}stopRender(){this.isRender=!1}startRender(){this.isRender=!0}createMarker(e,t,r="标题",i=.02,o="marker-body"){const d=document.createElement("div");d.style.fontSize="8px",d.classList.add(o);let l="";for(const e in t)l+=`<div style="disply: flex;flex-direction:column;margin-top: 0px;">\n <span style="font-family: '思源黑体'; color: rgb(177, 195, 212);font-size: 0.8rem;">${e}: </span>\n <span style="font-family: 'DINPRO-Bold';font-weight: 700; color: rgb(255, 255, 255);font-size: 1rem;">${t[e].value}</span>\n <span style="font-family: '微软雅黑';font-weight: 500; color: rgba(255, 255, 255, 0.7);font-size: 0.8rem;">${t[e].unit}</span>\n </div>`;const m=`\n <div style="font-size: 1rem;color: #fff;disply: flex:direction:column;align-items:center;">\n <span class="ui-button" style="font-family: 'DINPRO'; font-weight: 700; color: rgb(255, 255, 255);" >${r}</span>\n ${l}\n </div>\n `;d.innerHTML=m;const c=new n(d);c.element.style.pointerEvents="none",c.scale.setScalar(i);const a=this.box3.setFromObject(e),h=new s,p=new s;a.getCenter(h),a.getSize(p);const f=e.getWorldPosition(new s),{x:R,y:y,z:g}=f;return c.position.set(R,y+.005,g),c.name=t.name,c}}export{r as MarkerHtmlUI};
1
+ import{CSS3DRenderer as e,CSS3DSprite as n}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/renderers/CSS3DRenderer.esm.js";import"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{Box3 as t,Vector3 as s}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class r{engine;css3dRenderer;box3=new t;isRender=!1;constructor(e){this.engine=e,this.initCSS3DRenderer()}initCSS3DRenderer(){this.isRender=!0;const{clientWidth:n,clientHeight:t}=this.engine.container;this.css3dRenderer=new e,this.css3dRenderer.setSize(n,t),this.css3dRenderer.domElement.style.position="absolute",this.css3dRenderer.domElement.style.top="0px",this.css3dRenderer.domElement.style.left="0px",this.css3dRenderer.domElement.style.borderRadius="6px",this.css3dRenderer.domElement.style.pointerEvents="none",this.engine.container.appendChild(this.css3dRenderer.domElement),this.startRender()}render(){this.isRender&&this.css3dRenderer.render(this.engine.sceneGraph,this.engine.camera)}stopRender(){this.isRender=!1}startRender(){this.isRender=!0}createMarker(e,t,r="标题",i=.02,o="marker-body"){const d=document.createElement("div");d.style.fontSize="8px",d.classList.add(o);let l="";for(const e in t)l+=`<div style="disply: flex;flex-direction:column;margin-top: 0px;">\n <span style="font-family: '思源黑体'; color: rgb(177, 195, 212);font-size: 0.8rem;">${e}: </span>\n <span style="font-family: 'DINPRO-Bold';font-weight: 700; color: rgb(255, 255, 255);font-size: 1rem;">${t[e].value}</span>\n <span style="font-family: '微软雅黑';font-weight: 500; color: rgba(255, 255, 255, 0.7);font-size: 0.8rem;">${t[e].unit}</span>\n </div>`;const m=`\n <div style="font-size: 1rem;color: #fff;disply: flex:direction:column;align-items:center;">\n <span class="ui-button" style="font-family: 'DINPRO'; font-weight: 700; color: rgb(255, 255, 255);" >${r}</span>\n ${l}\n </div>\n `;d.innerHTML=m;const c=new n(d);c.element.style.pointerEvents="none",c.scale.setScalar(i);const a=this.box3.setFromObject(e),h=new s,p=new s;a.getCenter(h),a.getSize(p);const f=e.getWorldPosition(new s),{x:R,y:y,z:u}=f;return c.position.set(R,y+.005,u),c.name=t.name,c}}export{r as MarkerHtmlUI};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("../../../utils/Logger.cjs.js"),t=require("./MeshBuilder.cjs.js"),r=require("../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const s={radius:1,height:1,capSegments:4,radialSegments:8,heightSegments:1,material:new r.MeshPhongMaterial({color:16777215})};class a extends t.MeshBuilder{options=s;type="CapsuleBuilder";constructor(t="",r={},s){super(a.createGeometry(r),a.createMaterial(r)),this.name=t,this.options=r,s?s.add(this):e.Logger.error("BoxBuilder","Scene is not defined")}static createGeometry(e){const{radius:t,height:a,capSegments:i,radialSegments:n,heightSegments:o}={...s,...e};return new r.CapsuleGeometry(t,a,i,n,o)}static createMaterial(e){const{material:t}={...s,...e};return t instanceof r.Material?t:new r.MeshPhongMaterial({color:16777215})}}exports.CapsuleBuilder=a,exports.createCapsule=function(e="",t=s,r){return new a(e,t,r)};
@@ -0,0 +1 @@
1
+ import{Logger as e}from"../../../utils/Logger.esm.js";import{MeshBuilder as t}from"./MeshBuilder.esm.js";import{MeshPhongMaterial as r,CapsuleGeometry as s,Material as o}from"../../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const i={radius:1,height:1,capSegments:4,radialSegments:8,heightSegments:1,material:new r({color:16777215})};class n extends t{options=i;type="CapsuleBuilder";constructor(t="",r={},s){super(n.createGeometry(r),n.createMaterial(r)),this.name=t,this.options=r,s?s.add(this):e.error("BoxBuilder","Scene is not defined")}static createGeometry(e){const{radius:t,height:r,capSegments:o,radialSegments:n,heightSegments:a}={...i,...e};return new s(t,r,o,n,a)}static createMaterial(e){const{material:t}={...i,...e};return t instanceof o?t:new r({color:16777215})}}function a(e="",t=i,r){return new n(e,t,r)}export{n as CapsuleBuilder,a as createCapsule};
@@ -1 +1 @@
1
- "use strict";var e=require("./Builders/BoxBuilder.cjs.js"),r=require("./Builders/SphereBuilder.cjs.js"),l=require("./Builders/PlaneBuilder.cjs.js");const B={createBox:e.createBox,createSphere:r.createSphere,createPlane:l.createPlane};exports.BoxBuilder=e.BoxBuilder,exports.SphereBuilder=r.SphereBuilder,exports.PlaneBuilder=l.PlaneBuilder,exports.MeshBuilder=B;
1
+ "use strict";var e=require("./Builders/BoxBuilder.cjs.js"),r=require("./Builders/SphereBuilder.cjs.js"),l=require("./Builders/PlaneBuilder.cjs.js"),u=require("./Builders/CapsuleBuilder.cjs.js");const s={createBox:e.createBox,createSphere:r.createSphere,createPlane:l.createPlane,createCapsule:u.createCapsule};exports.BoxBuilder=e.BoxBuilder,exports.SphereBuilder=r.SphereBuilder,exports.PlaneBuilder=l.PlaneBuilder,exports.CapsuleBuilder=u.CapsuleBuilder,exports.MeshBuilder=s;
@@ -1 +1 @@
1
- import{createBox as e}from"./Builders/BoxBuilder.esm.js";export{BoxBuilder}from"./Builders/BoxBuilder.esm.js";import{createSphere as r}from"./Builders/SphereBuilder.esm.js";export{SphereBuilder}from"./Builders/SphereBuilder.esm.js";import{createPlane as l}from"./Builders/PlaneBuilder.esm.js";export{PlaneBuilder}from"./Builders/PlaneBuilder.esm.js";const s={createBox:e,createSphere:r,createPlane:l};export{s as MeshBuilder};
1
+ import{createBox as e}from"./Builders/BoxBuilder.esm.js";export{BoxBuilder}from"./Builders/BoxBuilder.esm.js";import{createSphere as r}from"./Builders/SphereBuilder.esm.js";export{SphereBuilder}from"./Builders/SphereBuilder.esm.js";import{createPlane as s}from"./Builders/PlaneBuilder.esm.js";export{PlaneBuilder}from"./Builders/PlaneBuilder.esm.js";import{createCapsule as l}from"./Builders/CapsuleBuilder.esm.js";export{CapsuleBuilder}from"./Builders/CapsuleBuilder.esm.js";const i={createBox:e,createSphere:r,createPlane:s,createCapsule:l};export{i as MeshBuilder};
@@ -1 +1 @@
1
- "use strict";var e=require("./types.cjs.js"),r=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/DRACOLoader.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/GLTFLoader.cjs.js"),s=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/RGBELoader.cjs.js"),d=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const t=new Map([[e.RESOURCE_TYPE.GLTF,function(e="https://www.gstatic.com/draco/versioned/decoders/1.5.7/"){const s=new r.DRACOLoader,d=new o.GLTFLoader;s&&(s.setDecoderPath(e),s.setDecoderConfig({type:"js"}),s.preload());d&&s&&d.setDRACOLoader(s);return d}()],[e.RESOURCE_TYPE.HDR,new s.RGBELoader],[e.RESOURCE_TYPE.TEXTURE,function(){const e=new d.TextureLoader;return e.setCrossOrigin("anonymous"),e}()]]);exports.GLTFLoader=o.GLTFLoader,exports.LoaderMaps=t;
1
+ "use strict";var e=require("./types.cjs.js"),r=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/DRACOLoader.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/GLTFLoader.cjs.js"),s=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/HDRLoader.cjs.js"),d=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const t=new Map([[e.RESOURCE_TYPE.GLTF,function(e="https://www.gstatic.com/draco/versioned/decoders/1.5.7/"){const s=new r.DRACOLoader,d=new o.GLTFLoader;s&&(s.setDecoderPath(e),s.setDecoderConfig({type:"js"}),s.preload());d&&s&&d.setDRACOLoader(s);return d}()],[e.RESOURCE_TYPE.HDR,new s.HDRLoader],[e.RESOURCE_TYPE.TEXTURE,function(){const e=new d.TextureLoader;return e.setCrossOrigin("anonymous"),e}()]]);exports.GLTFLoader=o.GLTFLoader,exports.LoaderMaps=t;
@@ -1 +1 @@
1
- import{RESOURCE_TYPE as e}from"./types.esm.js";import{DRACOLoader as o}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/DRACOLoader.esm.js";import{GLTFLoader as s}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/GLTFLoader.esm.js";import{RGBELoader as r}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/RGBELoader.esm.js";import{TextureLoader as m}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const t=new Map([[e.GLTF,function(e="https://www.gstatic.com/draco/versioned/decoders/1.5.7/"){const r=new o,m=new s;r&&(r.setDecoderPath(e),r.setDecoderConfig({type:"js"}),r.preload());m&&r&&m.setDRACOLoader(r);return m}()],[e.HDR,new r],[e.TEXTURE,function(){const e=new m;return e.setCrossOrigin("anonymous"),e}()]]);export{s as GLTFLoader,t as LoaderMaps};
1
+ import{RESOURCE_TYPE as e}from"./types.esm.js";import{DRACOLoader as o}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/DRACOLoader.esm.js";import{GLTFLoader as s}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/GLTFLoader.esm.js";import{HDRLoader as r}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/HDRLoader.esm.js";import{TextureLoader as m}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const t=new Map([[e.GLTF,function(e="https://www.gstatic.com/draco/versioned/decoders/1.5.7/"){const r=new o,m=new s;r&&(r.setDecoderPath(e),r.setDecoderConfig({type:"js"}),r.preload());m&&r&&m.setDRACOLoader(r);return m}()],[e.HDR,new r],[e.TEXTURE,function(){const e=new m;return e.setCrossOrigin("anonymous"),e}()]]);export{s as GLTFLoader,t as LoaderMaps};
@@ -1 +1 @@
1
- "use strict";var e=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js"),r=require("../../utils/index.cjs.js"),t=require("../Controls/index.cjs.js"),n=require("../Resource/ResourceManager.cjs.js"),s=require("../PostProcessor/index.cjs.js"),a=require("../MarkerHtmlUI/index.cjs.js"),i=require("../../utils/Logger.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const c={container:"body",antialias:!0,alpha:!1,backgroundColor:1514278,camera:"Perspective",isPostProcessing:!1};class h{container;activeCanvas=null;parameters=c;renderScopes;sceneGraph;camera;controls;renderer;VERSION="1.0.0";CONTROL_TYPE=t.CONTROL_TYPE;resourceManager;controlsManager;plugins=new Map;isPostProcessing=!1;markerHtmlUI;postProcessor;animateTimer;constructor(e){i.Logger.info("Hello PotatoGL.js!"),this.renderScopes=new Set,this.parameters={...this.parameters,...e},this.resourceManager=new n.ResourceManager(this),this.controlsManager=new t.ControlsManager(this),this.parameters.container||i.Logger.error("PotatoEngine","container is not defined")}async create(e){this.parameters=Object.assign(this.parameters,e);const{container:t}=this.parameters;return this.container=r.getContainerElement(t),this.sceneGraph=h.createScene(e),this.sceneGraph.background=new o.Color(this.parameters.backgroundColor),this.camera=h.createCamera(e,this.container),this.renderer=h.createRenderer(this.parameters,this.container),this.activeCanvas=this.renderer.domElement,this.container.appendChild(this.renderer.domElement),this.postProcessor=new s.PostProcessor(this),this.markerHtmlUI=new a.MarkerHtmlUI(this),this.initEngineInfo(this.activeCanvas),this}static createScene(e){const{backgroundColor:r}=e,t=new o.Scene;return t.background=new o.Color(r),t}static createCamera(e,r){const{camera:t}=e,{clientWidth:n,clientHeight:s}=r;let a;return a="Orthographic"===t?new o.OrthographicCamera(-n/2,n/2,s/2,-s/2,.01,1e3):new o.PerspectiveCamera(60,n/s,.01,1e3),a}static createRenderer(r,t=document.body){const{antialias:n,alpha:s}=r,a=new e.WebGLRenderer({antialias:n,alpha:s,powerPreference:"high-performance"}),{clientWidth:i,clientHeight:c}=t,h=1*window.devicePixelRatio;return a.setPixelRatio(h),a.setSize(i||500,c||300),a.outputColorSpace=o.SRGBColorSpace,a.toneMapping=o.ACESFilmicToneMapping,a.toneMappingExposure=1,a}runRenderLoop(e){e&&!this.renderScopes.has(e)&&this.renderScopes.add(e),this.sceneGraph&&this.camera&&this.renderer?(this.isPostProcessing?this.postProcessor?.render():this.renderer.render(this.sceneGraph,this.camera),this.markerHtmlUI.render(),this.renderScopes.forEach(e=>e({sceneGraph:this.sceneGraph,camera:this.camera,renderer:this.renderer})),this.animateTimer=requestAnimationFrame(()=>this.runRenderLoop())):i.Logger.error("PotatoEngine","Scene, Camera, Renderer is not defined")}addRunScope(e){this.renderScopes.has(e)&&i.Logger.warn("PotatoEngine","RunScope is already added"),this.renderScopes.add(e)}attachControl(e){if(this.camera&&this.renderer)return this.controls=this.controlsManager.createControls(e,this.camera,this.renderer.domElement),this.addRunScope(()=>this.controls.update()),this.controls;i.Logger.error("PotatoEngine","Camera, Renderer is not defined")}stopRenderLoop(){this.animateTimer&&(cancelAnimationFrame(this.animateTimer),this.animateTimer=0)}regieterPlugin(e,r){}initEngineInfo(e){e instanceof HTMLCanvasElement&&(e.style.borderRadius="5px"),"setAttribute"in e&&e.setAttribute("data-engine",`Potato.js V${this.VERSION}`)}}exports.PotatoEngine=h;
1
+ "use strict";var e=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js"),r=require("../../utils/index.cjs.js"),t=require("../Controls/index.cjs.js"),n=require("../Resource/ResourceManager.cjs.js"),s=require("../PostProcessor/index.cjs.js"),a=require("../MarkerHtmlUI/index.cjs.js"),i=require("../../utils/Logger.cjs.js"),o=require("../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const c={container:"body",antialias:!0,alpha:!1,backgroundColor:1514278,camera:"Perspective",isPostProcessing:!1};class h{container;activeCanvas=null;parameters=c;renderScopes;sceneGraph;camera;controls;renderer;VERSION="1.0.0";CONTROL_TYPE=t.CONTROL_TYPE;resourceManager;controlsManager;plugins=new Map;isPostProcessing=!1;markerHtmlUI;postProcessor;animateTimer;constructor(e){i.Logger.info("Hello PotatoGL.js!"),this.renderScopes=new Set,this.parameters={...this.parameters,...e},this.resourceManager=new n.ResourceManager(this),this.controlsManager=new t.ControlsManager(this),this.parameters.container||i.Logger.error("PotatoEngine","container is not defined")}async create(e){this.parameters=Object.assign(this.parameters,e);const{container:t}=this.parameters;return this.container=r.getContainerElement(t),this.sceneGraph=h.createScene(e),this.sceneGraph.background=new o.Color(this.parameters.backgroundColor),this.camera=h.createCamera(e,this.container),this.renderer=h.createRenderer(this.parameters,this.container),this.activeCanvas=this.renderer.domElement,this.container.appendChild(this.renderer.domElement),this.postProcessor=new s.PostProcessor(this),this.markerHtmlUI=new a.MarkerHtmlUI(this),this.initEngineInfo(this.activeCanvas),this}static createScene(e){const{backgroundColor:r}=e,t=new o.Scene;return t.background=new o.Color(r),t}static createCamera(e,r){const{camera:t}=e,{clientWidth:n,clientHeight:s}=r;let a;return a="Orthographic"===t?new o.OrthographicCamera(-n/2,n/2,s/2,-s/2,.01,1e3):new o.PerspectiveCamera(60,n/s,.01,1e3),a}static createRenderer(r,t=document.body){const{antialias:n,alpha:s}=r,a=new e.WebGLRenderer({antialias:n,alpha:s,powerPreference:"high-performance"}),{clientWidth:i,clientHeight:c}=t,h=1*window.devicePixelRatio;return a.setPixelRatio(h),a.setSize(i||500,c||300),a.outputColorSpace=o.SRGBColorSpace,a.toneMapping=o.ACESFilmicToneMapping,a.toneMappingExposure=1,a}runRenderLoop(e){e&&!this.renderScopes.has(e)&&this.renderScopes.add(e),this.sceneGraph&&this.camera&&this.renderer?(this.isPostProcessing?this.postProcessor?.render():this.renderer.render(this.sceneGraph,this.camera),this.markerHtmlUI&&this.markerHtmlUI.render(),this.renderScopes.forEach(e=>e({sceneGraph:this.sceneGraph,camera:this.camera,renderer:this.renderer})),this.animateTimer=requestAnimationFrame(()=>this.runRenderLoop())):i.Logger.error("PotatoEngine","Scene, Camera, Renderer is not defined")}addRunScope(e){this.renderScopes.has(e)&&i.Logger.warn("PotatoEngine","RunScope is already added"),this.renderScopes.add(e)}attachControl(e){if(this.camera&&this.renderer)return this.controls=this.controlsManager.createControls(e,this.camera,this.renderer.domElement),this.addRunScope(()=>this.controls.update()),this.controls;i.Logger.error("PotatoEngine","Camera, Renderer is not defined")}stopRenderLoop(){this.animateTimer&&(cancelAnimationFrame(this.animateTimer),this.animateTimer=0)}regieterPlugin(e,r){}initEngineInfo(e){e instanceof HTMLCanvasElement&&(e.style.borderRadius="6px"),"setAttribute"in e&&e.setAttribute("data-engine",`T3d-ez.gl V${this.VERSION}`)}}exports.PotatoEngine=h;
@@ -1 +1 @@
1
- import{WebGLRenderer as e}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{getContainerElement as r}from"../../utils/index.esm.js";import{CONTROL_TYPE as t,ControlsManager as s}from"../Controls/index.esm.js";import{ResourceManager as n}from"../Resource/ResourceManager.esm.js";import{PostProcessor as a}from"../PostProcessor/index.esm.js";import{MarkerHtmlUI as i}from"../MarkerHtmlUI/index.esm.js";import{Logger as o}from"../../utils/Logger.esm.js";import{Color as c,Scene as h,OrthographicCamera as m,PerspectiveCamera as d,SRGBColorSpace as p,ACESFilmicToneMapping as l}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const u={container:"body",antialias:!0,alpha:!1,backgroundColor:1514278,camera:"Perspective",isPostProcessing:!1};class g{container;activeCanvas=null;parameters=u;renderScopes;sceneGraph;camera;controls;renderer;VERSION="1.0.0";CONTROL_TYPE=t;resourceManager;controlsManager;plugins=new Map;isPostProcessing=!1;markerHtmlUI;postProcessor;animateTimer;constructor(e){o.info("Hello PotatoGL.js!"),this.renderScopes=new Set,this.parameters={...this.parameters,...e},this.resourceManager=new n(this),this.controlsManager=new s(this),this.parameters.container||o.error("PotatoEngine","container is not defined")}async create(e){this.parameters=Object.assign(this.parameters,e);const{container:t}=this.parameters;return this.container=r(t),this.sceneGraph=g.createScene(e),this.sceneGraph.background=new c(this.parameters.backgroundColor),this.camera=g.createCamera(e,this.container),this.renderer=g.createRenderer(this.parameters,this.container),this.activeCanvas=this.renderer.domElement,this.container.appendChild(this.renderer.domElement),this.postProcessor=new a(this),this.markerHtmlUI=new i(this),this.initEngineInfo(this.activeCanvas),this}static createScene(e){const{backgroundColor:r}=e,t=new h;return t.background=new c(r),t}static createCamera(e,r){const{camera:t}=e,{clientWidth:s,clientHeight:n}=r;let a;return a="Orthographic"===t?new m(-s/2,s/2,n/2,-n/2,.01,1e3):new d(60,s/n,.01,1e3),a}static createRenderer(r,t=document.body){const{antialias:s,alpha:n}=r,a=new e({antialias:s,alpha:n,powerPreference:"high-performance"}),{clientWidth:i,clientHeight:o}=t,c=1*window.devicePixelRatio;return a.setPixelRatio(c),a.setSize(i||500,o||300),a.outputColorSpace=p,a.toneMapping=l,a.toneMappingExposure=1,a}runRenderLoop(e){e&&!this.renderScopes.has(e)&&this.renderScopes.add(e),this.sceneGraph&&this.camera&&this.renderer?(this.isPostProcessing?this.postProcessor?.render():this.renderer.render(this.sceneGraph,this.camera),this.markerHtmlUI.render(),this.renderScopes.forEach(e=>e({sceneGraph:this.sceneGraph,camera:this.camera,renderer:this.renderer})),this.animateTimer=requestAnimationFrame(()=>this.runRenderLoop())):o.error("PotatoEngine","Scene, Camera, Renderer is not defined")}addRunScope(e){this.renderScopes.has(e)&&o.warn("PotatoEngine","RunScope is already added"),this.renderScopes.add(e)}attachControl(e){if(this.camera&&this.renderer)return this.controls=this.controlsManager.createControls(e,this.camera,this.renderer.domElement),this.addRunScope(()=>this.controls.update()),this.controls;o.error("PotatoEngine","Camera, Renderer is not defined")}stopRenderLoop(){this.animateTimer&&(cancelAnimationFrame(this.animateTimer),this.animateTimer=0)}regieterPlugin(e,r){}initEngineInfo(e){e instanceof HTMLCanvasElement&&(e.style.borderRadius="5px"),"setAttribute"in e&&e.setAttribute("data-engine",`Potato.js V${this.VERSION}`)}}export{g as PotatoEngine};
1
+ import{WebGLRenderer as e}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{getContainerElement as r}from"../../utils/index.esm.js";import{CONTROL_TYPE as t,ControlsManager as s}from"../Controls/index.esm.js";import{ResourceManager as n}from"../Resource/ResourceManager.esm.js";import{PostProcessor as a}from"../PostProcessor/index.esm.js";import{MarkerHtmlUI as i}from"../MarkerHtmlUI/index.esm.js";import{Logger as o}from"../../utils/Logger.esm.js";import{Color as c,Scene as h,OrthographicCamera as m,PerspectiveCamera as d,SRGBColorSpace as p,ACESFilmicToneMapping as l}from"../../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const u={container:"body",antialias:!0,alpha:!1,backgroundColor:1514278,camera:"Perspective",isPostProcessing:!1};class g{container;activeCanvas=null;parameters=u;renderScopes;sceneGraph;camera;controls;renderer;VERSION="1.0.0";CONTROL_TYPE=t;resourceManager;controlsManager;plugins=new Map;isPostProcessing=!1;markerHtmlUI;postProcessor;animateTimer;constructor(e){o.info("Hello PotatoGL.js!"),this.renderScopes=new Set,this.parameters={...this.parameters,...e},this.resourceManager=new n(this),this.controlsManager=new s(this),this.parameters.container||o.error("PotatoEngine","container is not defined")}async create(e){this.parameters=Object.assign(this.parameters,e);const{container:t}=this.parameters;return this.container=r(t),this.sceneGraph=g.createScene(e),this.sceneGraph.background=new c(this.parameters.backgroundColor),this.camera=g.createCamera(e,this.container),this.renderer=g.createRenderer(this.parameters,this.container),this.activeCanvas=this.renderer.domElement,this.container.appendChild(this.renderer.domElement),this.postProcessor=new a(this),this.markerHtmlUI=new i(this),this.initEngineInfo(this.activeCanvas),this}static createScene(e){const{backgroundColor:r}=e,t=new h;return t.background=new c(r),t}static createCamera(e,r){const{camera:t}=e,{clientWidth:s,clientHeight:n}=r;let a;return a="Orthographic"===t?new m(-s/2,s/2,n/2,-n/2,.01,1e3):new d(60,s/n,.01,1e3),a}static createRenderer(r,t=document.body){const{antialias:s,alpha:n}=r,a=new e({antialias:s,alpha:n,powerPreference:"high-performance"}),{clientWidth:i,clientHeight:o}=t,c=1*window.devicePixelRatio;return a.setPixelRatio(c),a.setSize(i||500,o||300),a.outputColorSpace=p,a.toneMapping=l,a.toneMappingExposure=1,a}runRenderLoop(e){e&&!this.renderScopes.has(e)&&this.renderScopes.add(e),this.sceneGraph&&this.camera&&this.renderer?(this.isPostProcessing?this.postProcessor?.render():this.renderer.render(this.sceneGraph,this.camera),this.markerHtmlUI&&this.markerHtmlUI.render(),this.renderScopes.forEach(e=>e({sceneGraph:this.sceneGraph,camera:this.camera,renderer:this.renderer})),this.animateTimer=requestAnimationFrame(()=>this.runRenderLoop())):o.error("PotatoEngine","Scene, Camera, Renderer is not defined")}addRunScope(e){this.renderScopes.has(e)&&o.warn("PotatoEngine","RunScope is already added"),this.renderScopes.add(e)}attachControl(e){if(this.camera&&this.renderer)return this.controls=this.controlsManager.createControls(e,this.camera,this.renderer.domElement),this.addRunScope(()=>this.controls.update()),this.controls;o.error("PotatoEngine","Camera, Renderer is not defined")}stopRenderLoop(){this.animateTimer&&(cancelAnimationFrame(this.animateTimer),this.animateTimer=0)}regieterPlugin(e,r){}initEngineInfo(e){e instanceof HTMLCanvasElement&&(e.style.borderRadius="6px"),"setAttribute"in e&&e.setAttribute("data-engine",`T3d-ez.gl V${this.VERSION}`)}}export{g as PotatoEngine};
@@ -0,0 +1 @@
1
+ "use strict";require("../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js");var e=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");class t extends e.AxesHelper{type="EditorAxesHelper";constructor(e){super(e),this.init(e)}init(t){const r=[-t,0,0,t,0,0,0,-t,0,0,t,0,0,0,-t,0,0,t];this.geometry.setAttribute("position",new e.Float32BufferAttribute(r,3)),this.geometry.setAttribute("color",new e.Float32BufferAttribute([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),this.material=new e.LineBasicMaterial({vertexColors:!0,toneMapped:!1}),this.material.depthTest=!1,this.material.transparent=!0,this.material.opacity=.15,this.setColors(new e.Color(15418969),new e.Color(8834357),new e.Color(4098799)),this.updateMatrixWorld(!0)}}exports.AxesAddHelper=t;
@@ -0,0 +1 @@
1
+ import"../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{AxesHelper as e,Float32BufferAttribute as t,LineBasicMaterial as r,Color as s}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class o extends e{type="EditorAxesHelper";constructor(e){super(e),this.init(e)}init(e){const o=[-e,0,0,e,0,0,0,-e,0,0,e,0,0,0,-e,0,0,e];this.geometry.setAttribute("position",new t(o,3)),this.geometry.setAttribute("color",new t([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),this.material=new r({vertexColors:!0,toneMapped:!1}),this.material.depthTest=!1,this.material.transparent=!0,this.material.opacity=.15,this.setColors(new s(15418969),new s(8834357),new s(4098799)),this.updateMatrixWorld(!0)}}export{o as AxesAddHelper};
@@ -1 +1 @@
1
- "use strict";var n=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");class e extends n.Mesh{constructor(e,o,i,r,t="xzy"){i=i||new n.Color("white"),e=e||10,o=o||100,r=r||8e3;const a=t.substr(0,2);super(new n.PlaneGeometry(2,2,1,1),new n.ShaderMaterial({side:n.DoubleSide,uniforms:{uSize1:{value:e},uSize2:{value:o},uColor:{value:i},uDistance:{value:r}},transparent:!0,vertexShader:`\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.${t} * uDistance;\n pos.${a} += cameraPosition.${a};\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n `,fragmentShader:`\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.${a} / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.${a}, worldPosition.${a}) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 4.0));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n `})),this.frustumCulled=!1}}exports.InfiniteGridHelper=e;
1
+ "use strict";var n=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");class e extends n.Mesh{constructor(e,o,i,r,t="xzy"){i=i||new n.Color("white"),e=e||10,o=o||100,r=r||8e3;const a=t.substr(0,2);super(new n.PlaneGeometry(2,2,1,1),new n.ShaderMaterial({side:n.BackSide,uniforms:{uSize1:{value:e},uSize2:{value:o},uColor:{value:i},uDistance:{value:r}},transparent:!0,vertexShader:`\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.${t} * uDistance;\n pos.${a} += cameraPosition.${a};\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n `,fragmentShader:`\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.${a} / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.${a}, worldPosition.${a}) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 4.0));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n `})),this.frustumCulled=!1}}exports.InfiniteGridHelper=e;
@@ -1 +1 @@
1
- import{Mesh as n,Color as o,PlaneGeometry as i,ShaderMaterial as e,DoubleSide as r}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class t extends n{constructor(n,t,a,l,s="xzy"){a=a||new o("white"),n=n||10,t=t||100,l=l||8e3;const u=s.substr(0,2);super(new i(2,2,1,1),new e({side:r,uniforms:{uSize1:{value:n},uSize2:{value:t},uColor:{value:a},uDistance:{value:l}},transparent:!0,vertexShader:`\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.${s} * uDistance;\n pos.${u} += cameraPosition.${u};\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n `,fragmentShader:`\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.${u} / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.${u}, worldPosition.${u}) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 4.0));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n `})),this.frustumCulled=!1}}export{t as InfiniteGridHelper};
1
+ import{Mesh as n,Color as o,PlaneGeometry as i,ShaderMaterial as e,BackSide as r}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";class t extends n{constructor(n,t,a,l,s="xzy"){a=a||new o("white"),n=n||10,t=t||100,l=l||8e3;const u=s.substr(0,2);super(new i(2,2,1,1),new e({side:r,uniforms:{uSize1:{value:n},uSize2:{value:t},uColor:{value:a},uDistance:{value:l}},transparent:!0,vertexShader:`\n \n varying vec3 worldPosition;\n \n uniform float uDistance;\n \n void main() {\n \n vec3 pos = position.${s} * uDistance;\n pos.${u} += cameraPosition.${u};\n \n worldPosition = pos;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);\n \n }\n `,fragmentShader:`\n \n varying vec3 worldPosition;\n \n uniform float uSize1;\n uniform float uSize2;\n uniform vec3 uColor;\n uniform float uDistance;\n \n \n \n float getGrid(float size) {\n \n vec2 r = worldPosition.${u} / size;\n \n \n vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);\n float line = min(grid.x, grid.y);\n \n \n return 1.0 - min(line, 1.0);\n }\n \n void main() {\n \n \n float d = 1.0 - min(distance(cameraPosition.${u}, worldPosition.${u}) / uDistance, 1.0);\n \n float g1 = getGrid(uSize1);\n float g2 = getGrid(uSize2);\n \n gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 4.0));\n gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);\n \n \n if ( gl_FragColor.a <= 0.0 ) discard;\n \n \n }\n \n `})),this.frustumCulled=!1}}export{t as InfiniteGridHelper};
@@ -0,0 +1 @@
1
+ "use strict";require("../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js");var t=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/src/math/MathUtils.cjs.js"),e=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/utils/BufferGeometryUtils.cjs.js"),o=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/Line2.cjs.js"),s=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineGeometry.cjs.js"),n=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineMaterial.cjs.js"),i=require("../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js");const r=(t,e)=>{const[o,s]=e.split("-");return Object.assign(t.style,{left:"left"===s?"0":"center"===s?"50%":"",right:"right"===s?"0":"",top:"top"===o?"0":"bottom"===o?"":"50%",bottom:"bottom"===o?"0":"",transform:`${"center"===s?"translateX(-50%)":""} ${"center"===o?"translateY(-50%)":""}`}),e},a=[["x",0,3],["y",1,4],["z",2,5]],c=new i.Vector3;function l({isSphere:e},o,s){e&&(c.set(0,0,1).applyQuaternion(s.quaternion),a.forEach(([e,s,n])=>{const i=c[e];let r=o[s],a=r.userData.opacity;r.material.opacity=t.clamp(i>=0?a:a/2,0,1),r=o[n],a=r.userData.opacity,r.material.opacity=t.clamp(i>=0?a/2:a,0,1)}))}const h=new i.Raycaster,p=new i.Vector2,d=(t,e,o,s)=>{p.set((t.clientX-e.left)/e.width*2-1,-(t.clientY-e.top)/e.height*2+1),h.setFromCamera(p,o);const n=h.intersectObjects(s,!1);if(n.length>0){n.sort((t,e)=>t.distance-e.distance);const t=.2,e=n[0].distance,o=n.filter(o=>o.distance<=e+t);o.length>1&&(o.sort((t,e)=>(e.object.userData.intersectionOrder||0)-(t.object.userData.intersectionOrder||0)),n.splice(0,o.length,...o))}const i=n.length?n[0]:null;return i&&i.object.visible?i:null},u=1e-6,m=2*Math.PI,_=["x","y","z"],g=[..._,"nx","ny","nz"],y=["x","z","y","nx","nz","ny"],f=["z","x","y","nz","nx","ny"],b="Right",w="Top",v="Front",x="Left",S="Bottom",E="Back",M=[b,w,v,x,S,E].map(t=>t.toLocaleLowerCase()),z=(t,e=!0)=>{const{material:o,userData:s}=t,{color:n,opacity:i}=e?s.hover:s;o.color.set(n),o.opacity=i},L=t=>JSON.parse(JSON.stringify(t)),j={yUp:{x:b,y:w,z:v,nx:x,ny:S,nz:E},zUp:{x:b,y:E,z:w,nx:x,ny:v,nz:S},xUp:{x:w,y:v,z:b,nx:S,ny:E,nz:x}};function D(t,...e){if(t instanceof HTMLElement||"object"!=typeof t||null===t)return t;for(const o of e)for(const e in o)"container"!==e&&e in o&&(void 0===t[e]?t[e]=o[e]:"object"!=typeof o[e]||Array.isArray(o[e])||(t[e]=D(t[e]||{},o[e])));return t}const A=(t,e=2)=>{const o=new i.Color,s=2*e,{isSphere:n,resolution:r,radius:a,font:c,corners:l,edges:h}=t,p=g.map(e=>({...t[e],radius:a}));n&&l.enabled&&p.push(l),n&&h.enabled&&p.push(h);const d=document.createElement("canvas"),u=d.getContext("2d");d.width=2*r+2*s,d.height=r*p.length+s*p.length;const[m,_]=function(e,o,s){const i=[...e].sort((t,e)=>(t.label?.length||0)-(e.label?.length||0)).pop().label,{family:r,weight:a}=s,c=n?Math.sqrt(Math.pow(.7*o,2)/2):o;let l=c;t.font.size>0&&(l=t.font.size);let h=0,p=0;do{u.font=`${a} ${l}px ${r}`;const t=u.measureText(i);h=t.width,p=t.fontBoundingBoxDescent,l--}while(h>c&&l>0);const d=c/p,m=Math.min(c/h,d),_=Math.floor(l*m);return[`${a} ${_}px ${r}`,d]}(p,r,c);p.forEach(({radius:t,label:o,color:n,labelColor:i,border:a,hover:{color:c,labelColor:l,border:h}},p)=>{const d=r*p+p*s+e;x(e,d,e,r,t,o,a,n,i),x(r+3*e,d,e,r,t,o,h??a,c??n,l??i)});const y=p.length,f=e/(2*r),b=e/(6*r),w=1/y,v=new i.CanvasTexture(d);return v.repeat.set(.5-2*f,w-2*b),v.offset.set(f,1-b),Object.assign(v,{colorSpace:i.SRGBColorSpace,wrapS:i.RepeatWrapping,wrapT:i.RepeatWrapping,userData:{offsetX:f,offsetY:b,cellHeight:w}}),v;function x(t,e,s,i,r,a,c,l,h){if(r*=i/2,null!=l&&""!==l&&(p(),u.fillStyle=o.set(l).getStyle(),u.fill()),c&&c.size){const s=c.size*i/2;t+=s,e+=s,i-=c.size*i,r=Math.max(0,r-s),p(),u.strokeStyle=o.set(c.color).getStyle(),u.lineWidth=c.size*i,u.stroke()}function p(){u.beginPath(),u.moveTo(t+r,e),u.lineTo(t+i-r,e),u.arcTo(t+i,e,t+i,e+r,r),u.lineTo(t+i,e+i-r),u.arcTo(t+i,e+i,t+i-r,e+i,r),u.lineTo(t+r,e+i),u.arcTo(t,e+i,t,e+i-r,r),u.lineTo(t,e+r),u.arcTo(t,e,t+r,e,r),u.closePath()}a&&function(t,e,o,s,i){t.font=m,t.textAlign="center",t.textBaseline="middle",t.fillStyle=i,t.fillText(s,e,o+(n?_:0))}(u,t+i/2,e+(i+s)/2,a,o.set(h).getStyle())}},C=(t,e)=>{const{offset:o,userData:{offsetY:s,cellHeight:n}}=t;o.y=1-(e+1)*n+s};function O(t,e,o=2,s=2){const n=o/2-t,r=s/2-t,a=t/o,c=(o-t)/o,l=t/s,h=(s-t)/s,p=[n,r,0,-n,r,0,-n,-r,0,n,-r,0],d=[c,h,a,h,a,l,c,l],u=[3*(e+1)+3,3*(e+1)+4,e+4,e+5,2*(e+1)+4,2,1,2*(e+1)+3,3,4*(e+1)+3,4,0],m=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11].map(t=>u[t]);let _,g,y,f,b,w,v,x;for(let o=0;o<4;o++){f=o<1||o>2?n:-n,b=o<2?r:-r,w=o<1||o>2?c:a,v=o<2?h:l;for(let s=0;s<=e;s++)_=Math.PI/2*(o+s/e),g=Math.cos(_),y=Math.sin(_),p.push(f+t*g,b+t*y,0),d.push(w+a*g,v+l*y),s<e&&(x=(e+1)*o+s+4,m.push(o,x,x+1))}return(new i.BufferGeometry).setIndex(new i.BufferAttribute(new Uint32Array(m),1)).setAttribute("position",new i.BufferAttribute(new Float32Array(p),3)).setAttribute("uv",new i.BufferAttribute(new Float32Array(d),2))}const P=t=>{const{corners:r,edges:a}=t,c=[],l=A(t),h=((t,e)=>{const o=new i.Vector3,{isSphere:s,radius:n,smoothness:r,type:a}=t,c="rounded-cube"===a?2-2*t.edges.radius:2,l=O(n,r,c,c);return g.map((n,r)=>{const a=r<3,c=g[r],h=r?e.clone():e;C(h,r);const{enabled:p,scale:d,opacity:u,hover:m}=t[c],_={map:h,opacity:u,transparent:!0},y=s?new i.Sprite(new i.SpriteMaterial(_)):new i.Mesh(l,new i.MeshBasicMaterial(_)),f=a?c:c[1];if(y.position[f]=(a?1:-1)*(s?1.3:1),!s){y.lookAt(o.copy(y.position).multiplyScalar(1.7));const t=1===i.Object3D.DEFAULT_UP.z,e=1===i.Object3D.DEFAULT_UP.x;(t||e)&&("z"===c&&t||"x"===c&&e?y.rotateZ(-Math.PI/2):("nz"===c&&t||"nx"===c&&e)&&y.rotateZ(Math.PI/2))}return y.scale.setScalar(d),y.renderOrder=1,y.visible=p,y.userData={scale:d,opacity:u,hover:m},y})})(t,l);c.push(...h),r.enabled&&c.push(...((t,e)=>{const{isSphere:o,corners:s,type:n}=t,r="rounded-cube"===n;if(!s.enabled)return[];const{color:a,opacity:c,scale:l,radius:h,smoothness:p,hover:d}=s,u=o?null:r?new i.SphereGeometry(h,2*p,p):O(h,p),m={transparent:!0,opacity:c},_=r?1-h:.85,g=[1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1].map(t=>t*_),y=new i.Vector3;return Array(g.length/3).fill(0).map((t,s)=>{if(o){const t=e.clone();C(t,6),m.map=t}else m.color=a;const n=o?new i.Sprite(new i.SpriteMaterial(m)):new i.Mesh(u,new i.MeshBasicMaterial(m)),r=3*s;return n.position.set(g[r],g[r+1],g[r+2]),o&&n.position.normalize().multiplyScalar(1.7),n.scale.setScalar(l),n.lookAt(y.copy(n.position).multiplyScalar(2)),n.renderOrder=1,n.userData={color:a,opacity:c,scale:l,hover:d,intersectionOrder:1},n})})(t,l)),a.enabled&&c.push(...((t,e,o)=>{const{isSphere:s,edges:n,type:r}=t,a="rounded-cube"===r;if(!n.enabled)return[];const{color:c,opacity:l,scale:h,hover:p,radius:d,smoothness:u}=n,m=a?2-2*d:1.2,_=s?null:a?new i.CylinderGeometry(d,d,m,4*u):O(d,u,m,.25),g={transparent:!0,opacity:l},y=a?1-d:.925,f=[0,1,1,0,-1,1,1,0,1,-1,0,1,0,1,-1,0,-1,-1,1,0,-1,-1,0,-1,1,1,0,1,-1,0,-1,1,0,-1,-1,0].map(t=>t*y),b=new i.Vector3,w=new i.Vector3(0,1,0);return Array(f.length/3).fill(0).map((t,n)=>{if(s){const t=e.clone();C(t,o),g.map=t}else g.color=c;const r=s?new i.Sprite(new i.SpriteMaterial(g)):new i.Mesh(_,new i.MeshBasicMaterial(g)),d=3*n;return r.position.set(f[d],f[d+1],f[d+2]),s&&r.position.normalize().multiplyScalar(1.7),r.scale.setScalar(h),r.up.copy(w),r.lookAt(b.copy(r.position).multiplyScalar(2)),a?(s||r.position.z||(r.rotation.z=Math.PI),s||r.position.x||(r.rotation.x=0),s||r.position.x||(r.rotation.z=Math.PI/2)):s||r.position.y||(r.rotation.z=Math.PI/2),r.renderOrder=1,r.userData={color:c,opacity:l,scale:h,hover:p},r})})(t,l,r.enabled?7:6));const p=((t,o)=>{const{isSphere:s,background:{enabled:n,color:r,opacity:a,hover:c}}=o;let l;const h=new i.MeshBasicMaterial({color:r,side:i.BackSide,opacity:a,transparent:!0,depthWrite:!1});if(!n)return null;if(s)l=new i.Mesh(new i.SphereGeometry(1.8,64,64),h);else{let o;t.forEach(t=>{const s=t.scale.x;t.scale.setScalar(.9),t.updateMatrix();const n=t.geometry.clone();n.applyMatrix4(t.matrix),o=o?e.mergeGeometries([o,n]):n,t.scale.setScalar(s)}),l=new i.Mesh(o,h)}return l.userData={color:r,opacity:a,hover:c},l})(h,t),d=(t=>{const e=new i.Color,r=[],a=[],{isSphere:c}=t;if(g.forEach((o,s)=>{const{enabled:n,line:i,scale:l,color:h}=t[o];if(!n||!i)return;const p=(c?1.3-l/2:.975)*(s<3?1:-1);r.push(o.includes("x")?p:0,o.includes("y")?p:0,o.includes("z")?p:0,0,0,0);const d=e.set(h).toArray();a.push(...d,...d)}),!r.length)return null;const l=(new s.LineGeometry).setPositions(r).setColors(a),h=new n.LineMaterial({linewidth:t.lineWidth,vertexColors:!0,resolution:new i.Vector2(window.innerWidth,window.innerHeight)});return new o.Line2(l,h).computeLineDistances()})(t);return[c,p,d]},U=(t,e=!0)=>{const{material:o,userData:s}=t,{opacity:n,color:i,scale:r}=e?s.hover:s;var a,c;t.scale.setScalar(r),o.opacity=n,o.map?(a=o.map,c=e,a.offset.x=(c?.5:0)+a.userData.offsetX):o.color.set(i)},T=new i.Matrix4,q=new i.Spherical,V=new i.Vector2,k=new i.Vector3,F=new i.Vector4,B=(new i.Quaternion).setFromAxisAngle(new i.Vector3(0,0,1),Math.PI/2),R=(new i.Quaternion).setFromAxisAngle(new i.Vector3(0,0,1),-Math.PI/2);class $ extends i.Object3D{enabled=!0;camera;renderer;options;target=new i.Vector3;animated=!0;speed=1;animating=!1;_options;_intersections;_background=null;_viewport=[0,0,0,0];_originalViewport=[0,0,0,0];_originalScissor=[0,0,0,0];_scene;_camera;_container;_domElement;_domRect;_dragging=!1;calc_distance=0;_clock=new i.Clock;_targetQuaternion=new i.Quaternion;_quaternionStart=new i.Quaternion;_quaternionEnd=new i.Quaternion;_pointerStart=new i.Vector2;_focus=null;_placement;_controls;_controlsListeners;constructor(t,e,o={}){super(),this.camera=t,this.renderer=e,this._scene=(new i.Scene).add(this),this.set(o)}get placement(){return this._placement}set placement(t){this._placement=r(this._domElement,t),this.domUpdate()}set(t={}){this.dispose(),this.options=t,this._options=(t=>{const e=t.type||"sphere",o="sphere"===e,s="rounded-cube"===e,n=t.resolution||o?64:128,r=i.Object3D.DEFAULT_UP,a=1===r.z,c=1===r.x,l=j[a?"zUp":c?"xUp":"yUp"],{container:h}=t;t.container=void 0,(t=JSON.parse(JSON.stringify(t))).container=h;const p=a?y:c?f:g;M.forEach((e,o)=>{t[e]&&(t[p[o]]=t[e])});const d={enabled:!0,color:16777215,opacity:1,scale:.7,labelColor:2236962,line:!1,border:{size:0,color:14540253},hover:{color:o?16777215:9688043,labelColor:2236962,opacity:1,scale:.7,border:{size:0,color:14540253}}},u={line:!1,scale:o?.45:.7,hover:{scale:o?.5:.7}},m={type:e,container:document.body,size:128,placement:"top-right",resolution:n,lineWidth:4,radius:o?1:s?.3:.2,smoothness:18,animated:!0,speed:1,background:{enabled:!0,color:o?16777215:14739180,opacity:o?0:1,hover:{color:o?16777215:14739180,opacity:o?.2:1}},font:{family:"sans-serif",weight:900},offset:{top:10,left:10,bottom:10,right:10},corners:{enabled:!o,color:o?15915362:16777215,opacity:1,scale:o?.15:.2,radius:1,smoothness:18,hover:{color:o?16777215:9688043,opacity:1,scale:o?.2:.225}},edges:{enabled:!o,color:o?15915362:s?15658734:16777215,opacity:o?1:0,radius:o?1:.125,smoothness:18,scale:o?.15:1,hover:{color:o?16777215:9688043,opacity:1,scale:o?.2:1}},x:{...L(d),...o?{label:"X",color:16725587,line:!0}:{label:l.x}},y:{...L(d),...o?{label:"Y",color:9100032,line:!0}:{label:l.y}},z:{...L(d),...o?{label:"Z",color:2920447,line:!0}:{label:l.z}},nx:{...L(u),label:o?"":l.nx},ny:{...L(u),label:o?"":l.ny},nz:{...L(u),label:o?"":l.nz}};if(D(t,m),s){const e=t;e.edges.radius=e.radius,e.edges.scale=1,e.edges.opacity=1,e.edges.hover.scale=1,e.edges.hover.opacity=1,e.corners.radius=e.radius,e.corners.scale=1,e.corners.opacity=1,e.corners.hover.scale=1,e.corners.hover.opacity=1,e.radius=0,g.forEach(t=>{e[t].scale=1,e[t].opacity=1,e[t].hover.scale=1,e[t].hover.opacity=1})}return _.forEach(e=>D(t[`n${e}`],L(t[e]))),{...t,isSphere:o}})(t),this._camera=this._options.isSphere?new i.OrthographicCamera(-1.8,1.8,1.8,-1.8,5,10):new i.PerspectiveCamera(26,1,5,10),this._camera.position.set(0,0,7);const[e,o,s]=P(this._options);o&&this.add(o),s&&this.add(s),this.add(...e),this._background=o,this._intersections=e;const{container:n,animated:a,speed:c}=this._options;return this.animated=a,this.speed=c,this._container=n?(t=>{const e="string"==typeof t?document.querySelector(t):t;if(!e)throw Error("Invalid DOM element");return e})(n):document.body,this._domElement=(({placement:t,size:e,offset:o,id:s,className:n})=>{const i=document.createElement("div"),{top:a,left:c,right:l,bottom:h}=o;return Object.assign(i.style,{id:s,position:"absolute",zIndex:"1000",height:`${e}px`,width:`${e}px`,margin:`${a}px ${l}px ${h}px ${c}px`,borderRadius:"100%"}),r(i,t),s&&(i.id=s),n&&(i.className=n),i})(this._options),this._domElement.onpointerdown=t=>this._onPointerDown(t),this._domElement.onpointermove=t=>this._onPointerMove(t),this._domElement.onpointerleave=()=>this._onPointerLeave(),this._container.appendChild(this._domElement),this._controls&&this.attachControls(this._controls),this.update(),this}render(){this.animating&&this._animate();const{renderer:t,_viewport:e}=this,o=t.getScissorTest(),s=t.autoClear;return t.autoClear=!1,t.setViewport(...e),o&&t.setScissor(...e),t.clear(!1,!0,!1),t.render(this._scene,this._camera),t.setViewport(...this._originalViewport),o&&t.setScissor(...this._originalScissor),t.autoClear=s,this}domUpdate(){this._domRect=this._domElement.getBoundingClientRect();const t=this.renderer,e=this._domRect,o=t.domElement.getBoundingClientRect();return this._viewport.splice(0,4,e.left-o.left,t.domElement.clientHeight-(e.top-o.top+e.height),e.width,e.height),t.getViewport(F).toArray(this._originalViewport),t.getScissorTest()&&t.getScissor(F).toArray(this._originalScissor),this}cameraUpdate(){return this._updateOrientation(),this}update(t=!0){return t&&this._controls&&this._controls.update(),this.domUpdate().cameraUpdate()}attachControls(t){return this.detachControls(),this.target=t.target,this._controlsListeners={start:()=>t.enabled=!1,end:()=>t.enabled=!0,change:()=>this.update(!1)},this.addEventListener("start",this._controlsListeners.start),this.addEventListener("end",this._controlsListeners.end),t.addEventListener("change",this._controlsListeners.change),this._controls=t,this}detachControls(){if(this._controlsListeners&&this._controls)return this.target=(new i.Vector3).copy(this._controls.target),this.removeEventListener("start",this._controlsListeners.start),this.removeEventListener("end",this._controlsListeners.end),this._controls.removeEventListener("change",this._controlsListeners.change),this._controlsListeners=void 0,this._controls=void 0,this}dispose(){this.detachControls(),this.children.forEach(t=>{this.remove(t);const e=t;e.material?.dispose(),e.material?.map?.dispose(),e.geometry?.dispose()}),this._domElement?.remove()}_updateOrientation(t=!0){t&&(this.quaternion.copy(this.camera.quaternion).invert(),this.updateMatrixWorld()),l(this._options,this._intersections,this.camera)}_animate(){const{position:t,quaternion:e}=this.camera;if(t.set(0,0,1),!this.animated)return t.applyQuaternion(this._quaternionEnd).multiplyScalar(this.calc_distance).add(this.target),e.copy(this._targetQuaternion),this._updateOrientation(),this.animating=!1,this.dispatchEvent({type:"change"}),void this.dispatchEvent({type:"end"});this._controls&&(this._controls.enabled=!1);const o=this._clock.getDelta()*m*this.speed;if(this._quaternionStart.rotateTowards(this._quaternionEnd,o),t.applyQuaternion(this._quaternionStart).multiplyScalar(this.calc_distance).add(this.target),e.rotateTowards(this._targetQuaternion,o),this._updateOrientation(),requestAnimationFrame(()=>this.dispatchEvent({type:"change"})),this._quaternionStart.angleTo(this._quaternionEnd)<u){if(this._controls){const t=this.camera.position.clone().sub(this.target).normalize();1===i.Object3D.DEFAULT_UP.z&&Math.abs(t.z)>.99?this.camera.position.set(0,-1e-6,this.camera.position.z):1===i.Object3D.DEFAULT_UP.x&&Math.abs(t.x)>.99&&this.camera.position.set(this.camera.position.x,u,0),this._controls.update(),this._controls.enabled=!0}this.animating=!1,this.dispatchEvent({type:"end"})}}setOrientation(t){const e=this.camera,o=this.target;if(k.copy(t).multiplyScalar(this.calc_distance),T.setPosition(k).lookAt(k,this.position,this.up),this._targetQuaternion.setFromRotationMatrix(T),k.add(o),T.lookAt(k,o,this.up),this._quaternionEnd.setFromRotationMatrix(T),T.setPosition(e.position).lookAt(e.position,o,this.up),this._quaternionStart.setFromRotationMatrix(T),1===i.Object3D.DEFAULT_UP.z&&Math.abs(t.z)>.99){const e=Math.sign(t.z);this._targetQuaternion.multiply(1===e?R:B),this._quaternionEnd.multiply(1===e?R:B)}else if(1===i.Object3D.DEFAULT_UP.x&&Math.abs(t.x)>.99){const e=Math.sign(t.x);this._targetQuaternion.multiply(1===e?R:B),this._quaternionEnd.multiply(1===e?R:B)}this.animating=!0,this._clock.start(),this.dispatchEvent({type:"start"})}_onPointerDown(e){if(!this.enabled)return;const o=e=>{if(!this._dragging){if(((t,e,o=10)=>Math.abs(t.clientX-e.x)<o&&Math.abs(t.clientY-e.y)<o)(e,this._pointerStart))return;this._dragging=!0}const o=V.set(e.clientX,e.clientY).sub(this._pointerStart).multiplyScalar(1/this._domRect.width*Math.PI),s=this.coordinateConversion(k.subVectors(this.camera.position,this.target)),n=q.setFromVector3(s);n.theta=r-o.x,n.phi=t.clamp(a-o.y,u,Math.PI-u),this.coordinateConversion(this.camera.position.setFromSpherical(n),!0).add(this.target),this.camera.lookAt(this.target),this.quaternion.copy(this.camera.quaternion).invert(),this._updateOrientation(!1),this.dispatchEvent({type:"change"})},s=()=>{if(document.removeEventListener("pointermove",o,!1),document.removeEventListener("pointerup",s,!1),!this._dragging)return this._handleClick(e);this._focus&&(U(this._focus,!1),this._focus=null),this._dragging=!1,this.dispatchEvent({type:"end"})};if(this.animating)return;e.preventDefault(),this._pointerStart.set(e.clientX,e.clientY);const n=this.coordinateConversion(k.subVectors(this.camera.position,this.target)),i=q.setFromVector3(n),r=i.theta,a=i.phi;this.calc_distance=i.radius,document.addEventListener("pointermove",o,!1),document.addEventListener("pointerup",s,!1),this.dispatchEvent({type:"start"})}coordinateConversion(t,e=!1){const{x:o,y:s,z:n}=t,r=i.Object3D.DEFAULT_UP;return 1===r.x?e?t.set(s,n,o):t.set(n,o,s):1===r.z?e?t.set(n,o,s):t.set(s,n,o):t}_onPointerMove(t){this.enabled&&!this._dragging&&(this._background&&z(this._background,!0),this._handleHover(t))}_onPointerLeave(){this.enabled&&!this._dragging&&(this._background&&z(this._background,!1),this._focus&&U(this._focus,!1),this._domElement.style.cursor="")}_handleClick(t){const e=d(t,this._domRect,this._camera,this._intersections);this._focus&&(U(this._focus,!1),this._focus=null),e&&(this.setOrientation(e.object.position),this.dispatchEvent({type:"change"}))}_handleHover(t){const e=d(t,this._domRect,this._camera,this._intersections),o=e?.object||null;this._focus!==o&&(this._domElement.style.cursor=o?"pointer":"",this._focus&&U(this._focus,!1),(this._focus=o)?U(o,!0):l(this._options,this._intersections,this.camera))}}exports.T3DEzViewportGizmo=$;
@@ -0,0 +1 @@
1
+ import"../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js";import{clamp as t}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/src/math/MathUtils.esm.js";import{mergeGeometries as e}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/utils/BufferGeometryUtils.esm.js";import{Line2 as o}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/Line2.esm.js";import{LineGeometry as s}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineGeometry.esm.js";import{LineMaterial as n}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineMaterial.esm.js";import{Quaternion as i,Vector3 as r,Object3D as a,Clock as c,Vector2 as l,Scene as h,OrthographicCamera as d,PerspectiveCamera as p,Vector4 as u,Matrix4 as m,Spherical as _,Raycaster as g,Color as y,CanvasTexture as f,RepeatWrapping as b,SRGBColorSpace as w,Sprite as v,SpriteMaterial as x,Mesh as E,MeshBasicMaterial as S,SphereGeometry as z,CylinderGeometry as L,BackSide as M,BufferGeometry as A,BufferAttribute as P}from"../node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js";const U=(t,e)=>{const[o,s]=e.split("-");return Object.assign(t.style,{left:"left"===s?"0":"center"===s?"50%":"",right:"right"===s?"0":"",top:"top"===o?"0":"bottom"===o?"":"50%",bottom:"bottom"===o?"0":"",transform:`${"center"===s?"translateX(-50%)":""} ${"center"===o?"translateY(-50%)":""}`}),e},D=[["x",0,3],["y",1,4],["z",2,5]],T=new r;function C({isSphere:e},o,s){e&&(T.set(0,0,1).applyQuaternion(s.quaternion),D.forEach(([e,s,n])=>{const i=T[e];let r=o[s],a=r.userData.opacity;r.material.opacity=t(i>=0?a:a/2,0,1),r=o[n],a=r.userData.opacity,r.material.opacity=t(i>=0?a/2:a,0,1)}))}const k=new g,j=new l,O=(t,e,o,s)=>{j.set((t.clientX-e.left)/e.width*2-1,-(t.clientY-e.top)/e.height*2+1),k.setFromCamera(j,o);const n=k.intersectObjects(s,!1);if(n.length>0){n.sort((t,e)=>t.distance-e.distance);const t=.2,e=n[0].distance,o=n.filter(o=>o.distance<=e+t);o.length>1&&(o.sort((t,e)=>(e.object.userData.intersectionOrder||0)-(t.object.userData.intersectionOrder||0)),n.splice(0,o.length,...o))}const i=n.length?n[0]:null;return i&&i.object.visible?i:null},q=1e-6,F=2*Math.PI,$=["x","y","z"],I=[...$,"nx","ny","nz"],R=["x","z","y","nx","nz","ny"],V=["z","x","y","nz","nx","ny"],Q="Right",B="Top",X="Front",Y="Left",H="Bottom",N="Back",W=[Q,B,X,Y,H,N].map(t=>t.toLocaleLowerCase()),J=(t,e=!0)=>{const{material:o,userData:s}=t,{color:n,opacity:i}=e?s.hover:s;o.color.set(n),o.opacity=i},Z=t=>JSON.parse(JSON.stringify(t)),G={yUp:{x:Q,y:B,z:X,nx:Y,ny:H,nz:N},zUp:{x:Q,y:N,z:B,nx:Y,ny:X,nz:H},xUp:{x:B,y:X,z:Q,nx:H,ny:N,nz:Y}};function K(t,...e){if(t instanceof HTMLElement||"object"!=typeof t||null===t)return t;for(const o of e)for(const e in o)"container"!==e&&e in o&&(void 0===t[e]?t[e]=o[e]:"object"!=typeof o[e]||Array.isArray(o[e])||(t[e]=K(t[e]||{},o[e])));return t}const tt=(t,e=2)=>{const o=new y,s=2*e,{isSphere:n,resolution:i,radius:r,font:a,corners:c,edges:l}=t,h=I.map(e=>({...t[e],radius:r}));n&&c.enabled&&h.push(c),n&&l.enabled&&h.push(l);const d=document.createElement("canvas"),p=d.getContext("2d");d.width=2*i+2*s,d.height=i*h.length+s*h.length;const[u,m]=function(e,o,s){const i=[...e].sort((t,e)=>(t.label?.length||0)-(e.label?.length||0)).pop().label,{family:r,weight:a}=s,c=n?Math.sqrt(Math.pow(.7*o,2)/2):o;let l=c;t.font.size>0&&(l=t.font.size);let h=0,d=0;do{p.font=`${a} ${l}px ${r}`;const t=p.measureText(i);h=t.width,d=t.fontBoundingBoxDescent,l--}while(h>c&&l>0);const u=c/d,m=Math.min(c/h,u),_=Math.floor(l*m);return[`${a} ${_}px ${r}`,u]}(h,i,a);h.forEach(({radius:t,label:o,color:n,labelColor:r,border:a,hover:{color:c,labelColor:l,border:h}},d)=>{const p=i*d+d*s+e;S(e,p,e,i,t,o,a,n,r),S(i+3*e,p,e,i,t,o,h??a,c??n,l??r)});const _=h.length,g=e/(2*i),v=e/(6*i),x=1/_,E=new f(d);return E.repeat.set(.5-2*g,x-2*v),E.offset.set(g,1-v),Object.assign(E,{colorSpace:w,wrapS:b,wrapT:b,userData:{offsetX:g,offsetY:v,cellHeight:x}}),E;function S(t,e,s,i,r,a,c,l,h){if(r*=i/2,null!=l&&""!==l&&(d(),p.fillStyle=o.set(l).getStyle(),p.fill()),c&&c.size){const s=c.size*i/2;t+=s,e+=s,i-=c.size*i,r=Math.max(0,r-s),d(),p.strokeStyle=o.set(c.color).getStyle(),p.lineWidth=c.size*i,p.stroke()}function d(){p.beginPath(),p.moveTo(t+r,e),p.lineTo(t+i-r,e),p.arcTo(t+i,e,t+i,e+r,r),p.lineTo(t+i,e+i-r),p.arcTo(t+i,e+i,t+i-r,e+i,r),p.lineTo(t+r,e+i),p.arcTo(t,e+i,t,e+i-r,r),p.lineTo(t,e+r),p.arcTo(t,e,t+r,e,r),p.closePath()}a&&function(t,e,o,s,i){t.font=u,t.textAlign="center",t.textBaseline="middle",t.fillStyle=i,t.fillText(s,e,o+(n?m:0))}(p,t+i/2,e+(i+s)/2,a,o.set(h).getStyle())}},et=(t,e)=>{const{offset:o,userData:{offsetY:s,cellHeight:n}}=t;o.y=1-(e+1)*n+s};function ot(t,e,o=2,s=2){const n=o/2-t,i=s/2-t,r=t/o,a=(o-t)/o,c=t/s,l=(s-t)/s,h=[n,i,0,-n,i,0,-n,-i,0,n,-i,0],d=[a,l,r,l,r,c,a,c],p=[3*(e+1)+3,3*(e+1)+4,e+4,e+5,2*(e+1)+4,2,1,2*(e+1)+3,3,4*(e+1)+3,4,0],u=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11].map(t=>p[t]);let m,_,g,y,f,b,w,v;for(let o=0;o<4;o++){y=o<1||o>2?n:-n,f=o<2?i:-i,b=o<1||o>2?a:r,w=o<2?l:c;for(let s=0;s<=e;s++)m=Math.PI/2*(o+s/e),_=Math.cos(m),g=Math.sin(m),h.push(y+t*_,f+t*g,0),d.push(b+r*_,w+c*g),s<e&&(v=(e+1)*o+s+4,u.push(o,v,v+1))}return(new A).setIndex(new P(new Uint32Array(u),1)).setAttribute("position",new P(new Float32Array(h),3)).setAttribute("uv",new P(new Float32Array(d),2))}const st=t=>{const{corners:i,edges:c}=t,h=[],d=tt(t),p=((t,e)=>{const o=new r,{isSphere:s,radius:n,smoothness:i,type:c}=t,l="rounded-cube"===c?2-2*t.edges.radius:2,h=ot(n,i,l,l);return I.map((n,i)=>{const r=i<3,c=I[i],l=i?e.clone():e;et(l,i);const{enabled:d,scale:p,opacity:u,hover:m}=t[c],_={map:l,opacity:u,transparent:!0},g=s?new v(new x(_)):new E(h,new S(_)),y=r?c:c[1];if(g.position[y]=(r?1:-1)*(s?1.3:1),!s){g.lookAt(o.copy(g.position).multiplyScalar(1.7));const t=1===a.DEFAULT_UP.z,e=1===a.DEFAULT_UP.x;(t||e)&&("z"===c&&t||"x"===c&&e?g.rotateZ(-Math.PI/2):("nz"===c&&t||"nx"===c&&e)&&g.rotateZ(Math.PI/2))}return g.scale.setScalar(p),g.renderOrder=1,g.visible=d,g.userData={scale:p,opacity:u,hover:m},g})})(t,d);h.push(...p),i.enabled&&h.push(...((t,e)=>{const{isSphere:o,corners:s,type:n}=t,i="rounded-cube"===n;if(!s.enabled)return[];const{color:a,opacity:c,scale:l,radius:h,smoothness:d,hover:p}=s,u=o?null:i?new z(h,2*d,d):ot(h,d),m={transparent:!0,opacity:c},_=i?1-h:.85,g=[1,1,1,-1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,-1,-1].map(t=>t*_),y=new r;return Array(g.length/3).fill(0).map((t,s)=>{if(o){const t=e.clone();et(t,6),m.map=t}else m.color=a;const n=o?new v(new x(m)):new E(u,new S(m)),i=3*s;return n.position.set(g[i],g[i+1],g[i+2]),o&&n.position.normalize().multiplyScalar(1.7),n.scale.setScalar(l),n.lookAt(y.copy(n.position).multiplyScalar(2)),n.renderOrder=1,n.userData={color:a,opacity:c,scale:l,hover:p,intersectionOrder:1},n})})(t,d)),c.enabled&&h.push(...((t,e,o)=>{const{isSphere:s,edges:n,type:i}=t,a="rounded-cube"===i;if(!n.enabled)return[];const{color:c,opacity:l,scale:h,hover:d,radius:p,smoothness:u}=n,m=a?2-2*p:1.2,_=s?null:a?new L(p,p,m,4*u):ot(p,u,m,.25),g={transparent:!0,opacity:l},y=a?1-p:.925,f=[0,1,1,0,-1,1,1,0,1,-1,0,1,0,1,-1,0,-1,-1,1,0,-1,-1,0,-1,1,1,0,1,-1,0,-1,1,0,-1,-1,0].map(t=>t*y),b=new r,w=new r(0,1,0);return Array(f.length/3).fill(0).map((t,n)=>{if(s){const t=e.clone();et(t,o),g.map=t}else g.color=c;const i=s?new v(new x(g)):new E(_,new S(g)),r=3*n;return i.position.set(f[r],f[r+1],f[r+2]),s&&i.position.normalize().multiplyScalar(1.7),i.scale.setScalar(h),i.up.copy(w),i.lookAt(b.copy(i.position).multiplyScalar(2)),a?(s||i.position.z||(i.rotation.z=Math.PI),s||i.position.x||(i.rotation.x=0),s||i.position.x||(i.rotation.z=Math.PI/2)):s||i.position.y||(i.rotation.z=Math.PI/2),i.renderOrder=1,i.userData={color:c,opacity:l,scale:h,hover:d},i})})(t,d,i.enabled?7:6));const u=((t,o)=>{const{isSphere:s,background:{enabled:n,color:i,opacity:r,hover:a}}=o;let c;const l=new S({color:i,side:M,opacity:r,transparent:!0,depthWrite:!1});if(!n)return null;if(s)c=new E(new z(1.8,64,64),l);else{let o;t.forEach(t=>{const s=t.scale.x;t.scale.setScalar(.9),t.updateMatrix();const n=t.geometry.clone();n.applyMatrix4(t.matrix),o=o?e([o,n]):n,t.scale.setScalar(s)}),c=new E(o,l)}return c.userData={color:i,opacity:r,hover:a},c})(p,t),m=(t=>{const e=new y,i=[],r=[],{isSphere:a}=t;if(I.forEach((o,s)=>{const{enabled:n,line:c,scale:l,color:h}=t[o];if(!n||!c)return;const d=(a?1.3-l/2:.975)*(s<3?1:-1);i.push(o.includes("x")?d:0,o.includes("y")?d:0,o.includes("z")?d:0,0,0,0);const p=e.set(h).toArray();r.push(...p,...p)}),!i.length)return null;const c=(new s).setPositions(i).setColors(r),h=new n({linewidth:t.lineWidth,vertexColors:!0,resolution:new l(window.innerWidth,window.innerHeight)});return new o(c,h).computeLineDistances()})(t);return[h,u,m]},nt=(t,e=!0)=>{const{material:o,userData:s}=t,{opacity:n,color:i,scale:r}=e?s.hover:s;var a,c;t.scale.setScalar(r),o.opacity=n,o.map?(a=o.map,c=e,a.offset.x=(c?.5:0)+a.userData.offsetX):o.color.set(i)},it=new m,rt=new _,at=new l,ct=new r,lt=new u,ht=(new i).setFromAxisAngle(new r(0,0,1),Math.PI/2),dt=(new i).setFromAxisAngle(new r(0,0,1),-Math.PI/2);class pt extends a{enabled=!0;camera;renderer;options;target=new r;animated=!0;speed=1;animating=!1;_options;_intersections;_background=null;_viewport=[0,0,0,0];_originalViewport=[0,0,0,0];_originalScissor=[0,0,0,0];_scene;_camera;_container;_domElement;_domRect;_dragging=!1;calc_distance=0;_clock=new c;_targetQuaternion=new i;_quaternionStart=new i;_quaternionEnd=new i;_pointerStart=new l;_focus=null;_placement;_controls;_controlsListeners;constructor(t,e,o={}){super(),this.camera=t,this.renderer=e,this._scene=(new h).add(this),this.set(o)}get placement(){return this._placement}set placement(t){this._placement=U(this._domElement,t),this.domUpdate()}set(t={}){this.dispose(),this.options=t,this._options=(t=>{const e=t.type||"sphere",o="sphere"===e,s="rounded-cube"===e,n=t.resolution||o?64:128,i=a.DEFAULT_UP,r=1===i.z,c=1===i.x,l=G[r?"zUp":c?"xUp":"yUp"],{container:h}=t;t.container=void 0,(t=JSON.parse(JSON.stringify(t))).container=h;const d=r?R:c?V:I;W.forEach((e,o)=>{t[e]&&(t[d[o]]=t[e])});const p={enabled:!0,color:16777215,opacity:1,scale:.7,labelColor:2236962,line:!1,border:{size:0,color:14540253},hover:{color:o?16777215:9688043,labelColor:2236962,opacity:1,scale:.7,border:{size:0,color:14540253}}},u={line:!1,scale:o?.45:.7,hover:{scale:o?.5:.7}},m={type:e,container:document.body,size:128,placement:"top-right",resolution:n,lineWidth:4,radius:o?1:s?.3:.2,smoothness:18,animated:!0,speed:1,background:{enabled:!0,color:o?16777215:14739180,opacity:o?0:1,hover:{color:o?16777215:14739180,opacity:o?.2:1}},font:{family:"sans-serif",weight:900},offset:{top:10,left:10,bottom:10,right:10},corners:{enabled:!o,color:o?15915362:16777215,opacity:1,scale:o?.15:.2,radius:1,smoothness:18,hover:{color:o?16777215:9688043,opacity:1,scale:o?.2:.225}},edges:{enabled:!o,color:o?15915362:s?15658734:16777215,opacity:o?1:0,radius:o?1:.125,smoothness:18,scale:o?.15:1,hover:{color:o?16777215:9688043,opacity:1,scale:o?.2:1}},x:{...Z(p),...o?{label:"X",color:16725587,line:!0}:{label:l.x}},y:{...Z(p),...o?{label:"Y",color:9100032,line:!0}:{label:l.y}},z:{...Z(p),...o?{label:"Z",color:2920447,line:!0}:{label:l.z}},nx:{...Z(u),label:o?"":l.nx},ny:{...Z(u),label:o?"":l.ny},nz:{...Z(u),label:o?"":l.nz}};if(K(t,m),s){const e=t;e.edges.radius=e.radius,e.edges.scale=1,e.edges.opacity=1,e.edges.hover.scale=1,e.edges.hover.opacity=1,e.corners.radius=e.radius,e.corners.scale=1,e.corners.opacity=1,e.corners.hover.scale=1,e.corners.hover.opacity=1,e.radius=0,I.forEach(t=>{e[t].scale=1,e[t].opacity=1,e[t].hover.scale=1,e[t].hover.opacity=1})}return $.forEach(e=>K(t[`n${e}`],Z(t[e]))),{...t,isSphere:o}})(t),this._camera=this._options.isSphere?new d(-1.8,1.8,1.8,-1.8,5,10):new p(26,1,5,10),this._camera.position.set(0,0,7);const[e,o,s]=st(this._options);o&&this.add(o),s&&this.add(s),this.add(...e),this._background=o,this._intersections=e;const{container:n,animated:i,speed:r}=this._options;return this.animated=i,this.speed=r,this._container=n?(t=>{const e="string"==typeof t?document.querySelector(t):t;if(!e)throw Error("Invalid DOM element");return e})(n):document.body,this._domElement=(({placement:t,size:e,offset:o,id:s,className:n})=>{const i=document.createElement("div"),{top:r,left:a,right:c,bottom:l}=o;return Object.assign(i.style,{id:s,position:"absolute",zIndex:"1000",height:`${e}px`,width:`${e}px`,margin:`${r}px ${c}px ${l}px ${a}px`,borderRadius:"100%"}),U(i,t),s&&(i.id=s),n&&(i.className=n),i})(this._options),this._domElement.onpointerdown=t=>this._onPointerDown(t),this._domElement.onpointermove=t=>this._onPointerMove(t),this._domElement.onpointerleave=()=>this._onPointerLeave(),this._container.appendChild(this._domElement),this._controls&&this.attachControls(this._controls),this.update(),this}render(){this.animating&&this._animate();const{renderer:t,_viewport:e}=this,o=t.getScissorTest(),s=t.autoClear;return t.autoClear=!1,t.setViewport(...e),o&&t.setScissor(...e),t.clear(!1,!0,!1),t.render(this._scene,this._camera),t.setViewport(...this._originalViewport),o&&t.setScissor(...this._originalScissor),t.autoClear=s,this}domUpdate(){this._domRect=this._domElement.getBoundingClientRect();const t=this.renderer,e=this._domRect,o=t.domElement.getBoundingClientRect();return this._viewport.splice(0,4,e.left-o.left,t.domElement.clientHeight-(e.top-o.top+e.height),e.width,e.height),t.getViewport(lt).toArray(this._originalViewport),t.getScissorTest()&&t.getScissor(lt).toArray(this._originalScissor),this}cameraUpdate(){return this._updateOrientation(),this}update(t=!0){return t&&this._controls&&this._controls.update(),this.domUpdate().cameraUpdate()}attachControls(t){return this.detachControls(),this.target=t.target,this._controlsListeners={start:()=>t.enabled=!1,end:()=>t.enabled=!0,change:()=>this.update(!1)},this.addEventListener("start",this._controlsListeners.start),this.addEventListener("end",this._controlsListeners.end),t.addEventListener("change",this._controlsListeners.change),this._controls=t,this}detachControls(){if(this._controlsListeners&&this._controls)return this.target=(new r).copy(this._controls.target),this.removeEventListener("start",this._controlsListeners.start),this.removeEventListener("end",this._controlsListeners.end),this._controls.removeEventListener("change",this._controlsListeners.change),this._controlsListeners=void 0,this._controls=void 0,this}dispose(){this.detachControls(),this.children.forEach(t=>{this.remove(t);const e=t;e.material?.dispose(),e.material?.map?.dispose(),e.geometry?.dispose()}),this._domElement?.remove()}_updateOrientation(t=!0){t&&(this.quaternion.copy(this.camera.quaternion).invert(),this.updateMatrixWorld()),C(this._options,this._intersections,this.camera)}_animate(){const{position:t,quaternion:e}=this.camera;if(t.set(0,0,1),!this.animated)return t.applyQuaternion(this._quaternionEnd).multiplyScalar(this.calc_distance).add(this.target),e.copy(this._targetQuaternion),this._updateOrientation(),this.animating=!1,this.dispatchEvent({type:"change"}),void this.dispatchEvent({type:"end"});this._controls&&(this._controls.enabled=!1);const o=this._clock.getDelta()*F*this.speed;if(this._quaternionStart.rotateTowards(this._quaternionEnd,o),t.applyQuaternion(this._quaternionStart).multiplyScalar(this.calc_distance).add(this.target),e.rotateTowards(this._targetQuaternion,o),this._updateOrientation(),requestAnimationFrame(()=>this.dispatchEvent({type:"change"})),this._quaternionStart.angleTo(this._quaternionEnd)<q){if(this._controls){const t=this.camera.position.clone().sub(this.target).normalize();1===a.DEFAULT_UP.z&&Math.abs(t.z)>.99?this.camera.position.set(0,-1e-6,this.camera.position.z):1===a.DEFAULT_UP.x&&Math.abs(t.x)>.99&&this.camera.position.set(this.camera.position.x,q,0),this._controls.update(),this._controls.enabled=!0}this.animating=!1,this.dispatchEvent({type:"end"})}}setOrientation(t){const e=this.camera,o=this.target;if(ct.copy(t).multiplyScalar(this.calc_distance),it.setPosition(ct).lookAt(ct,this.position,this.up),this._targetQuaternion.setFromRotationMatrix(it),ct.add(o),it.lookAt(ct,o,this.up),this._quaternionEnd.setFromRotationMatrix(it),it.setPosition(e.position).lookAt(e.position,o,this.up),this._quaternionStart.setFromRotationMatrix(it),1===a.DEFAULT_UP.z&&Math.abs(t.z)>.99){const e=Math.sign(t.z);this._targetQuaternion.multiply(1===e?dt:ht),this._quaternionEnd.multiply(1===e?dt:ht)}else if(1===a.DEFAULT_UP.x&&Math.abs(t.x)>.99){const e=Math.sign(t.x);this._targetQuaternion.multiply(1===e?dt:ht),this._quaternionEnd.multiply(1===e?dt:ht)}this.animating=!0,this._clock.start(),this.dispatchEvent({type:"start"})}_onPointerDown(e){if(!this.enabled)return;const o=e=>{if(!this._dragging){if(((t,e,o=10)=>Math.abs(t.clientX-e.x)<o&&Math.abs(t.clientY-e.y)<o)(e,this._pointerStart))return;this._dragging=!0}const o=at.set(e.clientX,e.clientY).sub(this._pointerStart).multiplyScalar(1/this._domRect.width*Math.PI),s=this.coordinateConversion(ct.subVectors(this.camera.position,this.target)),n=rt.setFromVector3(s);n.theta=r-o.x,n.phi=t(a-o.y,q,Math.PI-q),this.coordinateConversion(this.camera.position.setFromSpherical(n),!0).add(this.target),this.camera.lookAt(this.target),this.quaternion.copy(this.camera.quaternion).invert(),this._updateOrientation(!1),this.dispatchEvent({type:"change"})},s=()=>{if(document.removeEventListener("pointermove",o,!1),document.removeEventListener("pointerup",s,!1),!this._dragging)return this._handleClick(e);this._focus&&(nt(this._focus,!1),this._focus=null),this._dragging=!1,this.dispatchEvent({type:"end"})};if(this.animating)return;e.preventDefault(),this._pointerStart.set(e.clientX,e.clientY);const n=this.coordinateConversion(ct.subVectors(this.camera.position,this.target)),i=rt.setFromVector3(n),r=i.theta,a=i.phi;this.calc_distance=i.radius,document.addEventListener("pointermove",o,!1),document.addEventListener("pointerup",s,!1),this.dispatchEvent({type:"start"})}coordinateConversion(t,e=!1){const{x:o,y:s,z:n}=t,i=a.DEFAULT_UP;return 1===i.x?e?t.set(s,n,o):t.set(n,o,s):1===i.z?e?t.set(n,o,s):t.set(s,n,o):t}_onPointerMove(t){this.enabled&&!this._dragging&&(this._background&&J(this._background,!0),this._handleHover(t))}_onPointerLeave(){this.enabled&&!this._dragging&&(this._background&&J(this._background,!1),this._focus&&nt(this._focus,!1),this._domElement.style.cursor="")}_handleClick(t){const e=O(t,this._domRect,this._camera,this._intersections);this._focus&&(nt(this._focus,!1),this._focus=null),e&&(this.setOrientation(e.object.position),this.dispatchEvent({type:"change"}))}_handleHover(t){const e=O(t,this._domRect,this._camera,this._intersections),o=e?.object||null;this._focus!==o&&(this._domElement.style.cursor=o?"pointer":"",this._focus&&nt(this._focus,!1),(this._focus=o)?nt(o,!0):C(this._options,this._intersections,this.camera))}}export{pt as T3DEzViewportGizmo};