three-stdlib 2.6.3 → 2.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/{Nodes-ec4e1143.js → Nodes-894ac9dc.js} +0 -0
  2. package/{Nodes-427f68b0.js → Nodes-af575af7.js} +0 -0
  3. package/controls/ArcballControls.cjs.js +1 -1
  4. package/controls/ArcballControls.d.ts +161 -0
  5. package/controls/ArcballControls.js +554 -285
  6. package/controls/OrbitControls.cjs.js +1 -1
  7. package/controls/OrbitControls.d.ts +1 -0
  8. package/controls/OrbitControls.js +13 -2
  9. package/controls/TransformControls.cjs.js +1 -1
  10. package/controls/TransformControls.d.ts +2 -1
  11. package/controls/TransformControls.js +25 -26
  12. package/geometries/TeapotGeometry.js +2 -2
  13. package/geometries/TextGeometry.cjs.js +1 -0
  14. package/geometries/TextGeometry.d.ts +16 -0
  15. package/geometries/TextGeometry.js +26 -0
  16. package/index.cjs.js +1 -1
  17. package/index.d.ts +2 -0
  18. package/index.js +2 -0
  19. package/loaders/AMFLoader.js +1 -3
  20. package/loaders/ColladaLoader.cjs.js +1 -1
  21. package/loaders/ColladaLoader.js +58 -35
  22. package/loaders/EXRLoader.cjs.js +1 -1
  23. package/loaders/EXRLoader.js +197 -262
  24. package/loaders/FBXLoader.cjs.js +1 -1
  25. package/loaders/FBXLoader.js +41 -90
  26. package/loaders/FontLoader.cjs.js +1 -0
  27. package/loaders/FontLoader.d.ts +32 -0
  28. package/loaders/FontLoader.js +139 -0
  29. package/loaders/GLTFLoader.cjs.js +1 -1
  30. package/loaders/GLTFLoader.js +161 -75
  31. package/loaders/HDRCubeTextureLoader.cjs.js +1 -1
  32. package/loaders/HDRCubeTextureLoader.js +2 -2
  33. package/loaders/NodeMaterialLoader.cjs.js +1 -1
  34. package/loaders/RGBELoader.cjs.js +1 -1
  35. package/loaders/RGBELoader.js +10 -9
  36. package/loaders/RGBMLoader.cjs.js +1 -1
  37. package/loaders/RGBMLoader.js +181 -257
  38. package/loaders/STLLoader.js +7 -7
  39. package/loaders/SVGLoader.cjs.js +1 -1
  40. package/loaders/SVGLoader.js +46 -30
  41. package/loaders/VRMLLoader.cjs.js +1 -1
  42. package/loaders/VRMLLoader.js +2 -1
  43. package/nodes/accessors/CameraNode.js +12 -12
  44. package/nodes/accessors/PositionNode.js +3 -3
  45. package/nodes/accessors/ReflectNode.js +3 -3
  46. package/nodes/core/FunctionNode.js +3 -3
  47. package/nodes/core/InputNode.js +3 -3
  48. package/nodes/core/Node.js +6 -6
  49. package/nodes/core/TempNode.js +6 -6
  50. package/nodes/effects/BlurNode.js +3 -3
  51. package/nodes/math/MathNode.js +3 -3
  52. package/nodes/utils/VelocityNode.js +6 -6
  53. package/package.json +2 -2
  54. package/renderers/nodes/accessors/UVNode.js +1 -3
  55. package/renderers/nodes/core/AttributeNode.js +1 -3
  56. package/renderers/nodes/core/Node.js +4 -12
  57. package/renderers/nodes/core/NodeBuilder.js +6 -18
  58. package/webxr/ARButton.js +6 -6
  59. package/webxr/VRButton.js +6 -6
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("three");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e);const a=(e,t)=>(e%t+t)%t;class i extends t.EventDispatcher{constructor(e,n){super(),o.default(this,"object",void 0),o.default(this,"domElement",void 0),o.default(this,"enabled",!0),o.default(this,"target",new t.Vector3),o.default(this,"minDistance",0),o.default(this,"maxDistance",1/0),o.default(this,"minZoom",0),o.default(this,"maxZoom",1/0),o.default(this,"minPolarAngle",0),o.default(this,"maxPolarAngle",Math.PI),o.default(this,"minAzimuthAngle",-1/0),o.default(this,"maxAzimuthAngle",1/0),o.default(this,"enableDamping",!1),o.default(this,"dampingFactor",.05),o.default(this,"enableZoom",!0),o.default(this,"zoomSpeed",1),o.default(this,"enableRotate",!0),o.default(this,"rotateSpeed",1),o.default(this,"enablePan",!0),o.default(this,"panSpeed",1),o.default(this,"screenSpacePanning",!0),o.default(this,"keyPanSpeed",7),o.default(this,"autoRotate",!1),o.default(this,"autoRotateSpeed",2),o.default(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),o.default(this,"mouseButtons",{LEFT:t.MOUSE.ROTATE,MIDDLE:t.MOUSE.DOLLY,RIGHT:t.MOUSE.PAN}),o.default(this,"touches",{ONE:t.TOUCH.ROTATE,TWO:t.TOUCH.DOLLY_PAN}),o.default(this,"target0",void 0),o.default(this,"position0",void 0),o.default(this,"zoom0",void 0),o.default(this,"_domElementKeyEvents",null),o.default(this,"getPolarAngle",void 0),o.default(this,"getAzimuthalAngle",void 0),o.default(this,"setPolarAngle",void 0),o.default(this,"setAzimuthalAngle",void 0),o.default(this,"getDistance",void 0),o.default(this,"listenToKeyEvents",void 0),o.default(this,"saveState",void 0),o.default(this,"reset",void 0),o.default(this,"update",void 0),o.default(this,"connect",void 0),o.default(this,"dispose",void 0),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object instanceof t.PerspectiveCamera?this.object.zoom:1,this.getPolarAngle=()=>h.phi,this.getAzimuthalAngle=()=>h.theta,this.setPolarAngle=e=>{let t=a(e,2*Math.PI),n=h.phi;n<0&&(n+=2*Math.PI),t<0&&(t+=2*Math.PI);let o=Math.abs(t-n);2*Math.PI-o<o&&(t<n?t+=2*Math.PI:n+=2*Math.PI),m.phi=t-n,i.update()},this.setAzimuthalAngle=e=>{let t=a(e,2*Math.PI),n=h.theta;n<0&&(n+=2*Math.PI),t<0&&(t+=2*Math.PI);let o=Math.abs(t-n);2*Math.PI-o<o&&(t<n?t+=2*Math.PI:n+=2*Math.PI),m.theta=t-n,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=e=>{e.addEventListener("keydown",q),this._domElementKeyEvents=e},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object instanceof t.PerspectiveCamera?i.object.zoom:1},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object instanceof t.PerspectiveCamera&&(i.object.zoom=i.zoom0,i.object.updateProjectionMatrix()),i.dispatchEvent(r),i.update(),u=l.NONE},this.update=(()=>{const n=new t.Vector3,o=(new t.Quaternion).setFromUnitVectors(e.up,new t.Vector3(0,1,0)),a=o.clone().invert(),s=new t.Vector3,c=new t.Quaternion,E=2*Math.PI;return function(){const e=i.object.position;n.copy(e).sub(i.target),n.applyQuaternion(o),h.setFromVector3(n),i.autoRotate&&u===l.NONE&&N(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(h.theta+=m.theta*i.dampingFactor,h.phi+=m.phi*i.dampingFactor):(h.theta+=m.theta,h.phi+=m.phi);let t=i.minAzimuthAngle,g=i.maxAzimuthAngle;return isFinite(t)&&isFinite(g)&&(t<-Math.PI?t+=E:t>Math.PI&&(t-=E),g<-Math.PI?g+=E:g>Math.PI&&(g-=E),h.theta=t<=g?Math.max(t,Math.min(g,h.theta)):h.theta>(t+g)/2?Math.max(t,h.theta):Math.min(g,h.theta)),h.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,h.phi)),h.makeSafe(),h.radius*=p,h.radius=Math.max(i.minDistance,Math.min(i.maxDistance,h.radius)),!0===i.enableDamping?i.target.addScaledVector(b,i.dampingFactor):i.target.add(b),n.setFromSpherical(h),n.applyQuaternion(a),e.copy(i.target).add(n),i.object.lookAt(i.target),!0===i.enableDamping?(m.theta*=1-i.dampingFactor,m.phi*=1-i.dampingFactor,b.multiplyScalar(1-i.dampingFactor)):(m.set(0,0,0),b.set(0,0,0)),p=1,!!(f||s.distanceToSquared(i.object.position)>d||8*(1-c.dot(i.object.quaternion))>d)&&(i.dispatchEvent(r),s.copy(i.object.position),c.copy(i.object.quaternion),f=!1,!0)}})(),this.connect=e=>{e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),i.domElement=e,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",W),i.domElement.addEventListener("pointerdown",X),i.domElement.addEventListener("pointercancel",B),i.domElement.addEventListener("wheel",G)},this.dispose=()=>{var e,t,n,o,a,r;null===(e=i.domElement)||void 0===e||e.removeEventListener("contextmenu",W),null===(t=i.domElement)||void 0===t||t.removeEventListener("pointerdown",X),null===(n=i.domElement)||void 0===n||n.removeEventListener("pointercancel",B),null===(o=i.domElement)||void 0===o||o.removeEventListener("wheel",G),null===(a=i.domElement)||void 0===a||a.ownerDocument.removeEventListener("pointermove",Z),null===(r=i.domElement)||void 0===r||r.ownerDocument.removeEventListener("pointerup",K),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",q)};const i=this,r={type:"change"},s={type:"start"},c={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=l.NONE;const d=1e-6,h=new t.Spherical,m=new t.Spherical;let p=1;const b=new t.Vector3;let f=!1;const E=new t.Vector2,g=new t.Vector2,O=new t.Vector2,v=new t.Vector2,P=new t.Vector2,T=new t.Vector2,y=new t.Vector2,A=new t.Vector2,M=new t.Vector2,j=[],w={};function L(){return Math.pow(.95,i.zoomSpeed)}function N(e){m.theta-=e}function C(e){m.phi-=e}const I=(()=>{const e=new t.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),b.add(e)}})(),R=(()=>{const e=new t.Vector3;return function(t,n){!0===i.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(i.object.up,e)),e.multiplyScalar(t),b.add(e)}})(),S=(()=>{const e=new t.Vector3;return function(n,o){const a=i.domElement;if(a&&i.object instanceof t.PerspectiveCamera&&i.object.isPerspectiveCamera){const t=i.object.position;e.copy(t).sub(i.target);let r=e.length();r*=Math.tan(i.object.fov/2*Math.PI/180),I(2*n*r/a.clientHeight,i.object.matrix),R(2*o*r/a.clientHeight,i.object.matrix)}else a&&i.object instanceof t.OrthographicCamera&&i.object.isOrthographicCamera?(I(n*(i.object.right-i.object.left)/i.object.zoom/a.clientWidth,i.object.matrix),R(o*(i.object.top-i.object.bottom)/i.object.zoom/a.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function D(e){i.object instanceof t.PerspectiveCamera&&i.object.isPerspectiveCamera?p/=e:i.object instanceof t.OrthographicCamera&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*e)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function x(e){i.object instanceof t.PerspectiveCamera&&i.object.isPerspectiveCamera?p*=e:i.object instanceof t.OrthographicCamera&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/e)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function k(e){E.set(e.clientX,e.clientY)}function Y(e){v.set(e.clientX,e.clientY)}function H(){if(1==j.length)E.set(j[0].pageX,j[0].pageY);else{const e=.5*(j[0].pageX+j[1].pageX),t=.5*(j[0].pageY+j[1].pageY);E.set(e,t)}}function U(){if(1==j.length)v.set(j[0].pageX,j[0].pageY);else{const e=.5*(j[0].pageX+j[1].pageX),t=.5*(j[0].pageY+j[1].pageY);v.set(e,t)}}function _(){const e=j[0].pageX-j[1].pageX,t=j[0].pageY-j[1].pageY,n=Math.sqrt(e*e+t*t);y.set(0,n)}function V(e){if(1==j.length)g.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),o=.5*(e.pageY+t.y);g.set(n,o)}O.subVectors(g,E).multiplyScalar(i.rotateSpeed);const t=i.domElement;t&&(N(2*Math.PI*O.x/t.clientHeight),C(2*Math.PI*O.y/t.clientHeight)),E.copy(g)}function z(e){if(1==j.length)P.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),o=.5*(e.pageY+t.y);P.set(n,o)}T.subVectors(P,v).multiplyScalar(i.panSpeed),S(T.x,T.y),v.copy(P)}function F(e){const t=$(e),n=e.pageX-t.x,o=e.pageY-t.y,a=Math.sqrt(n*n+o*o);A.set(0,a),M.set(0,Math.pow(A.y/y.y,i.zoomSpeed)),D(M.y),y.copy(A)}function X(e){if(!1!==i.enabled){var n,o;if(0===j.length)null===(n=i.domElement)||void 0===n||n.ownerDocument.addEventListener("pointermove",Z),null===(o=i.domElement)||void 0===o||o.ownerDocument.addEventListener("pointerup",K);!function(e){j.push(e)}(e),"touch"===e.pointerType?function(e){switch(J(e),j.length){case 1:switch(i.touches.ONE){case t.TOUCH.ROTATE:if(!1===i.enableRotate)return;H(),u=l.TOUCH_ROTATE;break;case t.TOUCH.PAN:if(!1===i.enablePan)return;U(),u=l.TOUCH_PAN;break;default:u=l.NONE}break;case 2:switch(i.touches.TWO){case t.TOUCH.DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&_(),i.enablePan&&U(),u=l.TOUCH_DOLLY_PAN;break;case t.TOUCH.DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&_(),i.enableRotate&&H(),u=l.TOUCH_DOLLY_ROTATE;break;default:u=l.NONE}break;default:u=l.NONE}u!==l.NONE&&i.dispatchEvent(s)}(e):function(e){let n;switch(e.button){case 0:n=i.mouseButtons.LEFT;break;case 1:n=i.mouseButtons.MIDDLE;break;case 2:n=i.mouseButtons.RIGHT;break;default:n=-1}switch(n){case t.MOUSE.DOLLY:if(!1===i.enableZoom)return;!function(e){y.set(e.clientX,e.clientY)}(e),u=l.DOLLY;break;case t.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enablePan)return;Y(e),u=l.PAN}else{if(!1===i.enableRotate)return;k(e),u=l.ROTATE}break;case t.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enableRotate)return;k(e),u=l.ROTATE}else{if(!1===i.enablePan)return;Y(e),u=l.PAN}break;default:u=l.NONE}u!==l.NONE&&i.dispatchEvent(s)}(e)}}function Z(e){!1!==i.enabled&&("touch"===e.pointerType?function(e){switch(J(e),u){case l.TOUCH_ROTATE:if(!1===i.enableRotate)return;V(e),i.update();break;case l.TOUCH_PAN:if(!1===i.enablePan)return;z(e),i.update();break;case l.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(e){i.enableZoom&&F(e),i.enablePan&&z(e)}(e),i.update();break;case l.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(e){i.enableZoom&&F(e),i.enableRotate&&V(e)}(e),i.update();break;default:u=l.NONE}}(e):function(e){if(!1===i.enabled)return;switch(u){case l.ROTATE:if(!1===i.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),O.subVectors(g,E).multiplyScalar(i.rotateSpeed);const t=i.domElement;t&&(N(2*Math.PI*O.x/t.clientHeight),C(2*Math.PI*O.y/t.clientHeight)),E.copy(g),i.update()}(e);break;case l.DOLLY:if(!1===i.enableZoom)return;!function(e){A.set(e.clientX,e.clientY),M.subVectors(A,y),M.y>0?D(L()):M.y<0&&x(L()),y.copy(A),i.update()}(e);break;case l.PAN:if(!1===i.enablePan)return;!function(e){P.set(e.clientX,e.clientY),T.subVectors(P,v).multiplyScalar(i.panSpeed),S(T.x,T.y),v.copy(P),i.update()}(e)}}(e))}function K(e){var t,n,o;(Q(e),0===j.length)&&(null===(t=i.domElement)||void 0===t||t.releasePointerCapture(e.pointerId),null===(n=i.domElement)||void 0===n||n.ownerDocument.removeEventListener("pointermove",Z),null===(o=i.domElement)||void 0===o||o.ownerDocument.removeEventListener("pointerup",K));i.dispatchEvent(c),u=l.NONE}function B(e){Q(e)}function G(e){!1===i.enabled||!1===i.enableZoom||u!==l.NONE&&u!==l.ROTATE||(e.preventDefault(),i.dispatchEvent(s),function(e){e.deltaY<0?x(L()):e.deltaY>0&&D(L()),i.update()}(e),i.dispatchEvent(c))}function q(e){!1!==i.enabled&&!1!==i.enablePan&&function(e){let t=!1;switch(e.code){case i.keys.UP:S(0,i.keyPanSpeed),t=!0;break;case i.keys.BOTTOM:S(0,-i.keyPanSpeed),t=!0;break;case i.keys.LEFT:S(i.keyPanSpeed,0),t=!0;break;case i.keys.RIGHT:S(-i.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),i.update())}(e)}function W(e){!1!==i.enabled&&e.preventDefault()}function Q(e){delete w[e.pointerId];for(let t=0;t<j.length;t++)if(j[t].pointerId==e.pointerId)return void j.splice(t,1)}function J(e){let n=w[e.pointerId];void 0===n&&(n=new t.Vector2,w[e.pointerId]=n),n.set(e.pageX,e.pageY)}function $(e){const t=e.pointerId===j[0].pointerId?j[1]:j[0];return w[t.pointerId]}void 0!==n&&this.connect(n),this.update()}}exports.MapControls=class extends i{constructor(e,n){super(e,n),this.screenSpacePanning=!1,this.mouseButtons.LEFT=t.MOUSE.PAN,this.mouseButtons.RIGHT=t.MOUSE.ROTATE,this.touches.ONE=t.TOUCH.PAN,this.touches.TWO=t.TOUCH.DOLLY_ROTATE}},exports.OrbitControls=i;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("three");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e);const a=(e,t)=>(e%t+t)%t;class i extends t.EventDispatcher{constructor(e,n){super(),o.default(this,"object",void 0),o.default(this,"domElement",void 0),o.default(this,"enabled",!0),o.default(this,"target",new t.Vector3),o.default(this,"minDistance",0),o.default(this,"maxDistance",1/0),o.default(this,"minZoom",0),o.default(this,"maxZoom",1/0),o.default(this,"minPolarAngle",0),o.default(this,"maxPolarAngle",Math.PI),o.default(this,"minAzimuthAngle",-1/0),o.default(this,"maxAzimuthAngle",1/0),o.default(this,"enableDamping",!1),o.default(this,"dampingFactor",.05),o.default(this,"enableZoom",!0),o.default(this,"zoomSpeed",1),o.default(this,"enableRotate",!0),o.default(this,"rotateSpeed",1),o.default(this,"enablePan",!0),o.default(this,"panSpeed",1),o.default(this,"screenSpacePanning",!0),o.default(this,"keyPanSpeed",7),o.default(this,"autoRotate",!1),o.default(this,"autoRotateSpeed",2),o.default(this,"reverseOrbit",!1),o.default(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),o.default(this,"mouseButtons",{LEFT:t.MOUSE.ROTATE,MIDDLE:t.MOUSE.DOLLY,RIGHT:t.MOUSE.PAN}),o.default(this,"touches",{ONE:t.TOUCH.ROTATE,TWO:t.TOUCH.DOLLY_PAN}),o.default(this,"target0",void 0),o.default(this,"position0",void 0),o.default(this,"zoom0",void 0),o.default(this,"_domElementKeyEvents",null),o.default(this,"getPolarAngle",void 0),o.default(this,"getAzimuthalAngle",void 0),o.default(this,"setPolarAngle",void 0),o.default(this,"setAzimuthalAngle",void 0),o.default(this,"getDistance",void 0),o.default(this,"listenToKeyEvents",void 0),o.default(this,"saveState",void 0),o.default(this,"reset",void 0),o.default(this,"update",void 0),o.default(this,"connect",void 0),o.default(this,"dispose",void 0),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object instanceof t.PerspectiveCamera?this.object.zoom:1,this.getPolarAngle=()=>h.phi,this.getAzimuthalAngle=()=>h.theta,this.setPolarAngle=e=>{let t=a(e,2*Math.PI),n=h.phi;n<0&&(n+=2*Math.PI),t<0&&(t+=2*Math.PI);let o=Math.abs(t-n);2*Math.PI-o<o&&(t<n?t+=2*Math.PI:n+=2*Math.PI),m.phi=t-n,i.update()},this.setAzimuthalAngle=e=>{let t=a(e,2*Math.PI),n=h.theta;n<0&&(n+=2*Math.PI),t<0&&(t+=2*Math.PI);let o=Math.abs(t-n);2*Math.PI-o<o&&(t<n?t+=2*Math.PI:n+=2*Math.PI),m.theta=t-n,i.update()},this.getDistance=()=>i.object.position.distanceTo(i.target),this.listenToKeyEvents=e=>{e.addEventListener("keydown",q),this._domElementKeyEvents=e},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object instanceof t.PerspectiveCamera?i.object.zoom:1},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object instanceof t.PerspectiveCamera&&(i.object.zoom=i.zoom0,i.object.updateProjectionMatrix()),i.dispatchEvent(r),i.update(),u=l.NONE},this.update=(()=>{const n=new t.Vector3,o=(new t.Quaternion).setFromUnitVectors(e.up,new t.Vector3(0,1,0)),a=o.clone().invert(),s=new t.Vector3,c=new t.Quaternion,E=2*Math.PI;return function(){const e=i.object.position;n.copy(e).sub(i.target),n.applyQuaternion(o),h.setFromVector3(n),i.autoRotate&&u===l.NONE&&N(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(h.theta+=m.theta*i.dampingFactor,h.phi+=m.phi*i.dampingFactor):(h.theta+=m.theta,h.phi+=m.phi);let t=i.minAzimuthAngle,g=i.maxAzimuthAngle;return isFinite(t)&&isFinite(g)&&(t<-Math.PI?t+=E:t>Math.PI&&(t-=E),g<-Math.PI?g+=E:g>Math.PI&&(g-=E),h.theta=t<=g?Math.max(t,Math.min(g,h.theta)):h.theta>(t+g)/2?Math.max(t,h.theta):Math.min(g,h.theta)),h.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,h.phi)),h.makeSafe(),h.radius*=p,h.radius=Math.max(i.minDistance,Math.min(i.maxDistance,h.radius)),!0===i.enableDamping?i.target.addScaledVector(b,i.dampingFactor):i.target.add(b),n.setFromSpherical(h),n.applyQuaternion(a),e.copy(i.target).add(n),i.object.lookAt(i.target),!0===i.enableDamping?(m.theta*=1-i.dampingFactor,m.phi*=1-i.dampingFactor,b.multiplyScalar(1-i.dampingFactor)):(m.set(0,0,0),b.set(0,0,0)),p=1,!!(f||s.distanceToSquared(i.object.position)>d||8*(1-c.dot(i.object.quaternion))>d)&&(i.dispatchEvent(r),s.copy(i.object.position),c.copy(i.object.quaternion),f=!1,!0)}})(),this.connect=e=>{e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),i.domElement=e,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",W),i.domElement.addEventListener("pointerdown",X),i.domElement.addEventListener("pointercancel",B),i.domElement.addEventListener("wheel",G)},this.dispose=()=>{var e,t,n,o,a,r;null===(e=i.domElement)||void 0===e||e.removeEventListener("contextmenu",W),null===(t=i.domElement)||void 0===t||t.removeEventListener("pointerdown",X),null===(n=i.domElement)||void 0===n||n.removeEventListener("pointercancel",B),null===(o=i.domElement)||void 0===o||o.removeEventListener("wheel",G),null===(a=i.domElement)||void 0===a||a.ownerDocument.removeEventListener("pointermove",Z),null===(r=i.domElement)||void 0===r||r.ownerDocument.removeEventListener("pointerup",K),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",q)};const i=this,r={type:"change"},s={type:"start"},c={type:"end"},l={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=l.NONE;const d=1e-6,h=new t.Spherical,m=new t.Spherical;let p=1;const b=new t.Vector3;let f=!1;const E=new t.Vector2,g=new t.Vector2,O=new t.Vector2,v=new t.Vector2,P=new t.Vector2,T=new t.Vector2,y=new t.Vector2,A=new t.Vector2,M=new t.Vector2,j=[],w={};function L(){return Math.pow(.95,i.zoomSpeed)}function N(e){i.reverseOrbit?m.theta+=e:m.theta-=e}function C(e){i.reverseOrbit?m.phi+=e:m.phi-=e}const I=(()=>{const e=new t.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),b.add(e)}})(),R=(()=>{const e=new t.Vector3;return function(t,n){!0===i.screenSpacePanning?e.setFromMatrixColumn(n,1):(e.setFromMatrixColumn(n,0),e.crossVectors(i.object.up,e)),e.multiplyScalar(t),b.add(e)}})(),S=(()=>{const e=new t.Vector3;return function(n,o){const a=i.domElement;if(a&&i.object instanceof t.PerspectiveCamera&&i.object.isPerspectiveCamera){const t=i.object.position;e.copy(t).sub(i.target);let r=e.length();r*=Math.tan(i.object.fov/2*Math.PI/180),I(2*n*r/a.clientHeight,i.object.matrix),R(2*o*r/a.clientHeight,i.object.matrix)}else a&&i.object instanceof t.OrthographicCamera&&i.object.isOrthographicCamera?(I(n*(i.object.right-i.object.left)/i.object.zoom/a.clientWidth,i.object.matrix),R(o*(i.object.top-i.object.bottom)/i.object.zoom/a.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function D(e){i.object instanceof t.PerspectiveCamera&&i.object.isPerspectiveCamera?p/=e:i.object instanceof t.OrthographicCamera&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom*e)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function x(e){i.object instanceof t.PerspectiveCamera&&i.object.isPerspectiveCamera?p*=e:i.object instanceof t.OrthographicCamera&&i.object.isOrthographicCamera?(i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/e)),i.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function k(e){E.set(e.clientX,e.clientY)}function Y(e){v.set(e.clientX,e.clientY)}function H(){if(1==j.length)E.set(j[0].pageX,j[0].pageY);else{const e=.5*(j[0].pageX+j[1].pageX),t=.5*(j[0].pageY+j[1].pageY);E.set(e,t)}}function U(){if(1==j.length)v.set(j[0].pageX,j[0].pageY);else{const e=.5*(j[0].pageX+j[1].pageX),t=.5*(j[0].pageY+j[1].pageY);v.set(e,t)}}function _(){const e=j[0].pageX-j[1].pageX,t=j[0].pageY-j[1].pageY,n=Math.sqrt(e*e+t*t);y.set(0,n)}function V(e){if(1==j.length)g.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),o=.5*(e.pageY+t.y);g.set(n,o)}O.subVectors(g,E).multiplyScalar(i.rotateSpeed);const t=i.domElement;t&&(N(2*Math.PI*O.x/t.clientHeight),C(2*Math.PI*O.y/t.clientHeight)),E.copy(g)}function z(e){if(1==j.length)P.set(e.pageX,e.pageY);else{const t=$(e),n=.5*(e.pageX+t.x),o=.5*(e.pageY+t.y);P.set(n,o)}T.subVectors(P,v).multiplyScalar(i.panSpeed),S(T.x,T.y),v.copy(P)}function F(e){const t=$(e),n=e.pageX-t.x,o=e.pageY-t.y,a=Math.sqrt(n*n+o*o);A.set(0,a),M.set(0,Math.pow(A.y/y.y,i.zoomSpeed)),D(M.y),y.copy(A)}function X(e){if(!1!==i.enabled){var n,o;if(0===j.length)null===(n=i.domElement)||void 0===n||n.ownerDocument.addEventListener("pointermove",Z),null===(o=i.domElement)||void 0===o||o.ownerDocument.addEventListener("pointerup",K);!function(e){j.push(e)}(e),"touch"===e.pointerType?function(e){switch(J(e),j.length){case 1:switch(i.touches.ONE){case t.TOUCH.ROTATE:if(!1===i.enableRotate)return;H(),u=l.TOUCH_ROTATE;break;case t.TOUCH.PAN:if(!1===i.enablePan)return;U(),u=l.TOUCH_PAN;break;default:u=l.NONE}break;case 2:switch(i.touches.TWO){case t.TOUCH.DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;i.enableZoom&&_(),i.enablePan&&U(),u=l.TOUCH_DOLLY_PAN;break;case t.TOUCH.DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;i.enableZoom&&_(),i.enableRotate&&H(),u=l.TOUCH_DOLLY_ROTATE;break;default:u=l.NONE}break;default:u=l.NONE}u!==l.NONE&&i.dispatchEvent(s)}(e):function(e){let n;switch(e.button){case 0:n=i.mouseButtons.LEFT;break;case 1:n=i.mouseButtons.MIDDLE;break;case 2:n=i.mouseButtons.RIGHT;break;default:n=-1}switch(n){case t.MOUSE.DOLLY:if(!1===i.enableZoom)return;!function(e){y.set(e.clientX,e.clientY)}(e),u=l.DOLLY;break;case t.MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enablePan)return;Y(e),u=l.PAN}else{if(!1===i.enableRotate)return;k(e),u=l.ROTATE}break;case t.MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===i.enableRotate)return;k(e),u=l.ROTATE}else{if(!1===i.enablePan)return;Y(e),u=l.PAN}break;default:u=l.NONE}u!==l.NONE&&i.dispatchEvent(s)}(e)}}function Z(e){!1!==i.enabled&&("touch"===e.pointerType?function(e){switch(J(e),u){case l.TOUCH_ROTATE:if(!1===i.enableRotate)return;V(e),i.update();break;case l.TOUCH_PAN:if(!1===i.enablePan)return;z(e),i.update();break;case l.TOUCH_DOLLY_PAN:if(!1===i.enableZoom&&!1===i.enablePan)return;!function(e){i.enableZoom&&F(e),i.enablePan&&z(e)}(e),i.update();break;case l.TOUCH_DOLLY_ROTATE:if(!1===i.enableZoom&&!1===i.enableRotate)return;!function(e){i.enableZoom&&F(e),i.enableRotate&&V(e)}(e),i.update();break;default:u=l.NONE}}(e):function(e){if(!1===i.enabled)return;switch(u){case l.ROTATE:if(!1===i.enableRotate)return;!function(e){g.set(e.clientX,e.clientY),O.subVectors(g,E).multiplyScalar(i.rotateSpeed);const t=i.domElement;t&&(N(2*Math.PI*O.x/t.clientHeight),C(2*Math.PI*O.y/t.clientHeight)),E.copy(g),i.update()}(e);break;case l.DOLLY:if(!1===i.enableZoom)return;!function(e){A.set(e.clientX,e.clientY),M.subVectors(A,y),M.y>0?D(L()):M.y<0&&x(L()),y.copy(A),i.update()}(e);break;case l.PAN:if(!1===i.enablePan)return;!function(e){P.set(e.clientX,e.clientY),T.subVectors(P,v).multiplyScalar(i.panSpeed),S(T.x,T.y),v.copy(P),i.update()}(e)}}(e))}function K(e){var t,n,o;(Q(e),0===j.length)&&(null===(t=i.domElement)||void 0===t||t.releasePointerCapture(e.pointerId),null===(n=i.domElement)||void 0===n||n.ownerDocument.removeEventListener("pointermove",Z),null===(o=i.domElement)||void 0===o||o.ownerDocument.removeEventListener("pointerup",K));i.dispatchEvent(c),u=l.NONE}function B(e){Q(e)}function G(e){!1===i.enabled||!1===i.enableZoom||u!==l.NONE&&u!==l.ROTATE||(e.preventDefault(),i.dispatchEvent(s),function(e){e.deltaY<0?x(L()):e.deltaY>0&&D(L()),i.update()}(e),i.dispatchEvent(c))}function q(e){!1!==i.enabled&&!1!==i.enablePan&&function(e){let t=!1;switch(e.code){case i.keys.UP:S(0,i.keyPanSpeed),t=!0;break;case i.keys.BOTTOM:S(0,-i.keyPanSpeed),t=!0;break;case i.keys.LEFT:S(i.keyPanSpeed,0),t=!0;break;case i.keys.RIGHT:S(-i.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),i.update())}(e)}function W(e){!1!==i.enabled&&e.preventDefault()}function Q(e){delete w[e.pointerId];for(let t=0;t<j.length;t++)if(j[t].pointerId==e.pointerId)return void j.splice(t,1)}function J(e){let n=w[e.pointerId];void 0===n&&(n=new t.Vector2,w[e.pointerId]=n),n.set(e.pageX,e.pageY)}function $(e){const t=e.pointerId===j[0].pointerId?j[1]:j[0];return w[t.pointerId]}void 0!==n&&this.connect(n),this.update()}}exports.MapControls=class extends i{constructor(e,n){super(e,n),this.screenSpacePanning=!1,this.mouseButtons.LEFT=t.MOUSE.PAN,this.mouseButtons.RIGHT=t.MOUSE.ROTATE,this.touches.ONE=t.TOUCH.PAN,this.touches.TWO=t.TOUCH.DOLLY_ROTATE}},exports.OrbitControls=i;
@@ -24,6 +24,7 @@ declare class OrbitControls extends EventDispatcher {
24
24
  keyPanSpeed: number;
25
25
  autoRotate: boolean;
26
26
  autoRotateSpeed: number;
27
+ reverseOrbit: boolean;
27
28
  keys: {
28
29
  LEFT: string;
29
30
  UP: string;
@@ -33,6 +33,7 @@ class OrbitControls extends EventDispatcher {
33
33
  // Set to true to automatically rotate around the target
34
34
  // If auto-rotate is enabled, you must call controls.update() in your animation loop
35
35
  // 30 seconds per orbit when fps is 60
36
+ // true if you want to reverse the orbit to mouse drag from left to right = orbits left
36
37
  // The four arrow keys
37
38
  // Mouse buttons
38
39
  // Touch fingers
@@ -88,6 +89,8 @@ class OrbitControls extends EventDispatcher {
88
89
 
89
90
  _defineProperty(this, "autoRotateSpeed", 2.0);
90
91
 
92
+ _defineProperty(this, "reverseOrbit", false);
93
+
91
94
  _defineProperty(this, "keys", {
92
95
  LEFT: 'ArrowLeft',
93
96
  UP: 'ArrowUp',
@@ -391,11 +394,19 @@ class OrbitControls extends EventDispatcher {
391
394
  }
392
395
 
393
396
  function rotateLeft(angle) {
394
- sphericalDelta.theta -= angle;
397
+ if (scope.reverseOrbit) {
398
+ sphericalDelta.theta += angle;
399
+ } else {
400
+ sphericalDelta.theta -= angle;
401
+ }
395
402
  }
396
403
 
397
404
  function rotateUp(angle) {
398
- sphericalDelta.phi -= angle;
405
+ if (scope.reverseOrbit) {
406
+ sphericalDelta.phi += angle;
407
+ } else {
408
+ sphericalDelta.phi -= angle;
409
+ }
399
410
  }
400
411
 
401
412
  const panLeft = (() => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@babel/runtime/helpers/defineProperty"),e=require("three");function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=i(t);class o extends e.Object3D{constructor(t,i){super(),n.default(this,"isTransformControls",!0),n.default(this,"visible",!1),n.default(this,"domElement",void 0),n.default(this,"raycaster",new e.Raycaster),n.default(this,"gizmo",void 0),n.default(this,"plane",void 0),n.default(this,"tempVector",new e.Vector3),n.default(this,"tempVector2",new e.Vector3),n.default(this,"tempQuaternion",new e.Quaternion),n.default(this,"unit",{X:new e.Vector3(1,0,0),Y:new e.Vector3(0,1,0),Z:new e.Vector3(0,0,1)}),n.default(this,"pointStart",new e.Vector3),n.default(this,"pointEnd",new e.Vector3),n.default(this,"offset",new e.Vector3),n.default(this,"rotationAxis",new e.Vector3),n.default(this,"startNorm",new e.Vector3),n.default(this,"endNorm",new e.Vector3),n.default(this,"rotationAngle",0),n.default(this,"cameraPosition",new e.Vector3),n.default(this,"cameraQuaternion",new e.Quaternion),n.default(this,"cameraScale",new e.Vector3),n.default(this,"parentPosition",new e.Vector3),n.default(this,"parentQuaternion",new e.Quaternion),n.default(this,"parentQuaternionInv",new e.Quaternion),n.default(this,"parentScale",new e.Vector3),n.default(this,"worldPositionStart",new e.Vector3),n.default(this,"worldQuaternionStart",new e.Quaternion),n.default(this,"worldScaleStart",new e.Vector3),n.default(this,"worldPosition",new e.Vector3),n.default(this,"worldQuaternion",new e.Quaternion),n.default(this,"worldQuaternionInv",new e.Quaternion),n.default(this,"worldScale",new e.Vector3),n.default(this,"eye",new e.Vector3),n.default(this,"positionStart",new e.Vector3),n.default(this,"quaternionStart",new e.Quaternion),n.default(this,"scaleStart",new e.Vector3),n.default(this,"camera",void 0),n.default(this,"object",void 0),n.default(this,"enabled",!0),n.default(this,"axis",null),n.default(this,"mode","translate"),n.default(this,"translationSnap",null),n.default(this,"rotationSnap",null),n.default(this,"scaleSnap",null),n.default(this,"space","world"),n.default(this,"size",1),n.default(this,"dragging",!1),n.default(this,"showX",!0),n.default(this,"showY",!0),n.default(this,"showZ",!0),n.default(this,"changeEvent",{type:"change"}),n.default(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),n.default(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),n.default(this,"objectChangeEvent",{type:"objectChange"}),n.default(this,"intersectObjectWithRay",((t,e,i)=>{const n=e.intersectObject(t,!0);for(let t=0;t<n.length;t++)if(n[t].object.visible||i)return n[t];return!1})),n.default(this,"attach",(t=>(this.object=t,this.visible=!0,this))),n.default(this,"detach",(()=>(this.object=void 0,this.visible=!1,this.axis=null,this))),n.default(this,"updateMatrixWorld",(()=>{void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()})),n.default(this,"pointerHover",(t=>{if(void 0===this.object||!0===this.dragging)return;this.raycaster.setFromCamera(t,this.camera);const e=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);this.axis=e?e.object.name:null})),n.default(this,"pointerDown",(t=>{if(void 0!==this.object&&!0!==this.dragging&&0===t.button&&null!==this.axis){this.raycaster.setFromCamera(t,this.camera);const e=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(e){let t=this.space;if("scale"===this.mode?t="local":"E"!==this.axis&&"XYZE"!==this.axis&&"XYZ"!==this.axis||(t="world"),"local"===t&&"rotate"===this.mode){const t=this.rotationSnap;"X"===this.axis&&t&&(this.object.rotation.x=Math.round(this.object.rotation.x/t)*t),"Y"===this.axis&&t&&(this.object.rotation.y=Math.round(this.object.rotation.y/t)*t),"Z"===this.axis&&t&&(this.object.rotation.z=Math.round(this.object.rotation.z/t)*t)}this.object.updateMatrixWorld(),this.object.parent&&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,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}})),n.default(this,"pointerMove",(t=>{const e=this.axis,i=this.mode,n=this.object;let o=this.space;if("scale"===i?o="local":"E"!==e&&"XYZE"!==e&&"XYZ"!==e||(o="world"),void 0===n||null===e||!1===this.dragging||-1!==t.button)return;this.raycaster.setFromCamera(t,this.camera);const s=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(s){if(this.pointEnd.copy(s.point).sub(this.worldPositionStart),"translate"===i)this.offset.copy(this.pointEnd).sub(this.pointStart),"local"===o&&"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"===o&&"XYZ"!==e?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),n.position.copy(this.offset).add(this.positionStart),this.translationSnap&&("local"===o&&(n.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),-1!==e.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this.quaternionStart)),"world"===o&&(n.parent&&n.position.add(this.tempVector.setFromMatrixPosition(n.parent.matrixWorld)),-1!==e.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(this.tempVector.setFromMatrixPosition(n.parent.matrixWorld))));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),this.tempVector2.set(t,t,t)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),-1===e.search("X")&&(this.tempVector2.x=1),-1===e.search("Y")&&(this.tempVector2.y=1),-1===e.search("Z")&&(this.tempVector2.z=1);n.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(-1!==e.search("X")&&(this.object.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Z")&&(n.scale.z=Math.round(n.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(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));"E"===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):"XYZE"===e?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*t):"X"!==e&&"Y"!==e&&"Z"!==e||(this.rotationAxis.copy(this.unit[e]),this.tempVector.copy(this.unit[e]),"local"===o&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*t),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===o&&"E"!==e&&"XYZE"!==e?(n.quaternion.copy(this.quaternionStart),n.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),n.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}})),n.default(this,"pointerUp",(t=>{0===t.button&&(this.dragging&&null!==this.axis&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)})),n.default(this,"getPointer",(t=>{var e;if(this.domElement&&null!==(e=this.domElement.ownerDocument)&&void 0!==e&&e.pointerLockElement)return{x:0,y:0,button:t.button};{var i;const e=t.changedTouches?t.changedTouches[0]:t,n=null===(i=this.domElement)||void 0===i?void 0:i.getBoundingClientRect();return{x:(e.clientX-n.left)/n.width*2-1,y:-(e.clientY-n.top)/n.height*2+1,button:t.button}}})),n.default(this,"onPointerHover",(t=>{if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(t))}})),n.default(this,"onPointerDown",(t=>{var e;this.enabled&&(this.domElement.style.touchAction="none",null===(e=this.domElement.ownerDocument)||void 0===e||e.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(t)),this.pointerDown(this.getPointer(t)))})),n.default(this,"onPointerMove",(t=>{this.enabled&&this.pointerMove(this.getPointer(t))})),n.default(this,"onPointerUp",(t=>{var e;this.enabled&&(this.domElement.style.touchAction="",null===(e=this.domElement.ownerDocument)||void 0===e||e.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(t)))})),n.default(this,"getMode",(()=>this.mode)),n.default(this,"setMode",(t=>{this.mode=t})),n.default(this,"setTranslationSnap",(t=>{this.translationSnap=t})),n.default(this,"setRotationSnap",(t=>{this.rotationSnap=t})),n.default(this,"setScaleSnap",(t=>{this.scaleSnap=t})),n.default(this,"setSize",(t=>{this.size=t})),n.default(this,"setSpace",(t=>{this.space=t})),n.default(this,"update",(()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")})),n.default(this,"dispose",(()=>{var t,e;this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointermove",this.onPointerHover),null===(t=this.domElement.ownerDocument)||void 0===t||t.removeEventListener("pointermove",this.onPointerMove),null===(e=this.domElement.ownerDocument)||void 0===e||e.removeEventListener("pointerup",this.onPointerUp),this.traverse((t=>{const e=t;e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))})),void 0===i&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),this.domElement=document),this.domElement=i,this.camera=t,this.gizmo=new s,this.add(this.gizmo),this.plane=new a,this.add(this.plane);const o=(t,e)=>{let i=e;Object.defineProperty(this,t,{get:function(){return void 0!==i?i:e},set:function(e){i!==e&&(i=e,this.plane[t]=e,this.gizmo[t]=e,this.dispatchEvent({type:t+"-changed",value:e}),this.dispatchEvent(this.changeEvent))}}),this[t]=e,this.plane[t]=e,this.gizmo[t]=e};o("camera",this.camera),o("object",this.object),o("enabled",this.enabled),o("axis",this.axis),o("mode",this.mode),o("translationSnap",this.translationSnap),o("rotationSnap",this.rotationSnap),o("scaleSnap",this.scaleSnap),o("space",this.space),o("size",this.size),o("dragging",this.dragging),o("showX",this.showX),o("showY",this.showY),o("showZ",this.showZ),o("worldPosition",this.worldPosition),o("worldPositionStart",this.worldPositionStart),o("worldQuaternion",this.worldQuaternion),o("worldQuaternionStart",this.worldQuaternionStart),o("cameraPosition",this.cameraPosition),o("cameraQuaternion",this.cameraQuaternion),o("pointStart",this.pointStart),o("pointEnd",this.pointEnd),o("rotationAxis",this.rotationAxis),o("rotationAngle",this.rotationAngle),o("eye",this.eye),i.addEventListener("pointerdown",this.onPointerDown),i.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}}class s extends e.Object3D{constructor(){super(),n.default(this,"isTransformControlsGizmo",!0),n.default(this,"type","TransformControlsGizmo"),n.default(this,"tempVector",new e.Vector3(0,0,0)),n.default(this,"tempEuler",new e.Euler),n.default(this,"alignVector",new e.Vector3(0,1,0)),n.default(this,"zeroVector",new e.Vector3(0,0,0)),n.default(this,"lookAtMatrix",new e.Matrix4),n.default(this,"tempQuaternion",new e.Quaternion),n.default(this,"tempQuaternion2",new e.Quaternion),n.default(this,"identityQuaternion",new e.Quaternion),n.default(this,"unitX",new e.Vector3(1,0,0)),n.default(this,"unitY",new e.Vector3(0,1,0)),n.default(this,"unitZ",new e.Vector3(0,0,1)),n.default(this,"gizmo",void 0),n.default(this,"picker",void 0),n.default(this,"helper",void 0),n.default(this,"rotationAxis",new e.Vector3),n.default(this,"cameraPosition",new e.Vector3),n.default(this,"worldPositionStart",new e.Vector3),n.default(this,"worldQuaternionStart",new e.Quaternion),n.default(this,"worldPosition",new e.Vector3),n.default(this,"worldQuaternion",new e.Quaternion),n.default(this,"eye",new e.Vector3),n.default(this,"camera",null),n.default(this,"enabled",!0),n.default(this,"axis",null),n.default(this,"mode","translate"),n.default(this,"space","world"),n.default(this,"size",1),n.default(this,"dragging",!1),n.default(this,"showX",!0),n.default(this,"showY",!0),n.default(this,"showZ",!0),n.default(this,"updateMatrixWorld",(()=>{let t=this.space;"scale"===this.mode&&(t="local");const i="local"===t?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;let n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let t=0;t<n.length;t++){const o=n[t];let s;if(o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition),s=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(s*this.size/7),"helper"!==o.tag){if(o.quaternion.copy(i),"translate"===this.mode||"scale"===this.mode){const t=.99,e=.2,n=0;"X"!==o.name&&"XYZX"!==o.name||Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(i).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"Y"!==o.name&&"XYZY"!==o.name||Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(i).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"Z"!==o.name&&"XYZZ"!==o.name||Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(i).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"XY"===o.name&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(i).dot(this.eye))<e&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"YZ"===o.name&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(i).dot(this.eye))<e&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"XZ"===o.name&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(i).dot(this.eye))<e&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),-1!==o.name.search("X")&&(this.alignVector.copy(this.unitX).applyQuaternion(i).dot(this.eye)<n?"fwd"===o.tag?o.visible=!1:o.scale.x*=-1:"bwd"===o.tag&&(o.visible=!1)),-1!==o.name.search("Y")&&(this.alignVector.copy(this.unitY).applyQuaternion(i).dot(this.eye)<n?"fwd"===o.tag?o.visible=!1:o.scale.y*=-1:"bwd"===o.tag&&(o.visible=!1)),-1!==o.name.search("Z")&&(this.alignVector.copy(this.unitZ).applyQuaternion(i).dot(this.eye)<n?"fwd"===o.tag?o.visible=!1:o.scale.z*=-1:"bwd"===o.tag&&(o.visible=!1))}else"rotate"===this.mode&&(this.tempQuaternion2.copy(i),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(i).invert()),-1!==o.name.search("E")&&o.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),"X"===o.name&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),o.quaternion.copy(this.tempQuaternion)),"Y"===o.name&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),o.quaternion.copy(this.tempQuaternion)),"Z"===o.name&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),o.quaternion.copy(this.tempQuaternion)));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),o.material.tempOpacity=o.material.tempOpacity||o.material.opacity,o.material.tempColor=o.material.tempColor||o.material.color.clone(),o.material.color.copy(o.material.tempColor),o.material.opacity=o.material.tempOpacity,this.enabled?this.axis&&(o.name===this.axis||this.axis.split("").some((function(t){return o.name===t}))?(o.material.opacity=1,o.material.color.lerp(new e.Color(1,1,1),.5)):(o.material.opacity*=.25,o.material.color.lerp(new e.Color(1,1,1),.5))):(o.material.opacity*=.5,o.material.color.lerp(new e.Color(1,1,1),.5))}else o.visible=!1,"AXIS"===o.name?(o.position.copy(this.worldPositionStart),o.visible=!!this.axis,"X"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),o.quaternion.copy(i).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),"Y"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),o.quaternion.copy(i).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),"Z"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),o.quaternion.copy(i).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),"XYZE"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),o.quaternion.multiply(this.tempQuaternion),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),this.tempVector.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(this.tempVector),o.visible=this.dragging):(o.quaternion.copy(i),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=-1!==this.axis.search(o.name)))}super.updateMatrixWorld()}));const t=new e.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:e.DoubleSide,fog:!1,toneMapped:!1}),i=new e.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),o=t.clone();o.opacity=.15;const s=t.clone();s.opacity=.33;const a=t.clone();a.color.set(16711680);const r=t.clone();r.color.set(65280);const h=t.clone();h.color.set(255);const l=t.clone();l.opacity=.25;const c=l.clone();c.color.set(16776960);const u=l.clone();u.color.set(65535);const d=l.clone();d.color.set(16711935);t.clone().color.set(16776960);const p=i.clone();p.color.set(16711680);const m=i.clone();m.color.set(65280);const w=i.clone();w.color.set(255);const y=i.clone();y.color.set(65535);const f=i.clone();f.color.set(16711935);const M=i.clone();M.color.set(16776960);const g=i.clone();g.color.set(7895160);const b=M.clone();b.opacity=.25;const v=new e.CylinderGeometry(0,.05,.2,12,1,!1),Q=new e.BoxGeometry(.125,.125,.125),P=new e.BufferGeometry;P.setAttribute("position",new e.Float32BufferAttribute([0,0,0,1,0,0],3));const x=(t,i)=>{const n=new e.BufferGeometry,o=[];for(let e=0;e<=64*i;++e)o.push(0,Math.cos(e/32*Math.PI)*t,Math.sin(e/32*Math.PI)*t);return n.setAttribute("position",new e.Float32BufferAttribute(o,3)),n},V={X:[[new e.Mesh(v,a),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new e.Mesh(v,a),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new e.Line(P,p)]],Y:[[new e.Mesh(v,r),[0,1,0],null,null,"fwd"],[new e.Mesh(v,r),[0,1,0],[Math.PI,0,0],null,"bwd"],[new e.Line(P,m),null,[0,0,Math.PI/2]]],Z:[[new e.Mesh(v,h),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new e.Mesh(v,h),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new e.Line(P,w),null,[0,-Math.PI/2,0]]],XYZ:[[new e.Mesh(new e.OctahedronGeometry(.1,0),l.clone()),[0,0,0],[0,0,0]]],XY:[[new e.Mesh(new e.PlaneGeometry(.295,.295),c.clone()),[.15,.15,0]],[new e.Line(P,M),[.18,.3,0],null,[.125,1,1]],[new e.Line(P,M),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new e.Mesh(new e.PlaneGeometry(.295,.295),u.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new e.Line(P,y),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new e.Line(P,y),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new e.Mesh(new e.PlaneGeometry(.295,.295),d.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new e.Line(P,f),[.18,0,.3],null,[.125,1,1]],[new e.Line(P,f),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},S={X:[[new e.Mesh(new e.CylinderGeometry(.2,0,1,4,1,!1),o),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new e.Mesh(new e.CylinderGeometry(.2,0,1,4,1,!1),o),[0,.6,0]]],Z:[[new e.Mesh(new e.CylinderGeometry(.2,0,1,4,1,!1),o),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new e.Mesh(new e.OctahedronGeometry(.2,0),o)]],XY:[[new e.Mesh(new e.PlaneGeometry(.4,.4),o),[.2,.2,0]]],YZ:[[new e.Mesh(new e.PlaneGeometry(.4,.4),o),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new e.Mesh(new e.PlaneGeometry(.4,.4),o),[.2,0,.2],[-Math.PI/2,0,0]]]},E={START:[[new e.Mesh(new e.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new e.Mesh(new e.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new e.Line((()=>{const t=new e.BufferGeometry;return t.setAttribute("position",new e.Float32BufferAttribute([0,0,0,1,1,1],3)),t})(),s),null,null,null,"helper"]],X:[[new e.Line(P,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new e.Line(P,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new e.Line(P,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},Y={X:[[new e.Line(x(1,.5),p)],[new e.Mesh(new e.OctahedronGeometry(.04,0),a),[0,0,.99],null,[1,3,1]]],Y:[[new e.Line(x(1,.5),m),null,[0,0,-Math.PI/2]],[new e.Mesh(new e.OctahedronGeometry(.04,0),r),[0,0,.99],null,[3,1,1]]],Z:[[new e.Line(x(1,.5),w),null,[0,Math.PI/2,0]],[new e.Mesh(new e.OctahedronGeometry(.04,0),h),[.99,0,0],null,[1,3,1]]],E:[[new e.Line(x(1.25,1),b),null,[0,Math.PI/2,0]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new e.Line(x(1,1),g),null,[0,Math.PI/2,0]]]},X={AXIS:[[new e.Line(P,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},Z={X:[[new e.Mesh(new e.TorusGeometry(1,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new e.Mesh(new e.TorusGeometry(1,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new e.Mesh(new e.TorusGeometry(1,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new e.Mesh(new e.TorusGeometry(1.25,.1,2,24),o)]],XYZE:[[new e.Mesh(new e.SphereGeometry(.7,10,8),o)]]},I={X:[[new e.Mesh(Q,a),[.8,0,0],[0,0,-Math.PI/2]],[new e.Line(P,p),null,null,[.8,1,1]]],Y:[[new e.Mesh(Q,r),[0,.8,0]],[new e.Line(P,m),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new e.Mesh(Q,h),[0,0,.8],[Math.PI/2,0,0]],[new e.Line(P,w),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new e.Mesh(Q,c),[.85,.85,0],null,[2,2,.2]],[new e.Line(P,M),[.855,.98,0],null,[.125,1,1]],[new e.Line(P,M),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new e.Mesh(Q,u),[0,.85,.85],null,[.2,2,2]],[new e.Line(P,y),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new e.Line(P,y),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new e.Mesh(Q,d),[.85,0,.85],null,[2,.2,2]],[new e.Line(P,f),[.855,0,.98],null,[.125,1,1]],[new e.Line(P,f),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new e.Mesh(new e.BoxGeometry(.125,.125,.125),l.clone()),[1.1,0,0]]],XYZY:[[new e.Mesh(new e.BoxGeometry(.125,.125,.125),l.clone()),[0,1.1,0]]],XYZZ:[[new e.Mesh(new e.BoxGeometry(.125,.125,.125),l.clone()),[0,0,1.1]]]},A={X:[[new e.Mesh(new e.CylinderGeometry(.2,0,.8,4,1,!1),o),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new e.Mesh(new e.CylinderGeometry(.2,0,.8,4,1,!1),o),[0,.5,0]]],Z:[[new e.Mesh(new e.CylinderGeometry(.2,0,.8,4,1,!1),o),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new e.Mesh(Q,o),[.85,.85,0],null,[3,3,.2]]],YZ:[[new e.Mesh(Q,o),[0,.85,.85],null,[.2,3,3]]],XZ:[[new e.Mesh(Q,o),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),o),[1.1,0,0]]],XYZY:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),o),[0,1.1,0]]],XYZZ:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),o),[0,0,1.1]]]},z={X:[[new e.Line(P,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new e.Line(P,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new e.Line(P,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},j=t=>{const i=new e.Object3D;for(let e in t)for(let n=t[e].length;n--;){const o=t[e][n][0].clone(),s=t[e][n][1],a=t[e][n][2],r=t[e][n][3],h=t[e][n][4];o.name=e,o.tag=h,s&&o.position.set(s[0],s[1],s[2]),a&&o.rotation.set(a[0],a[1],a[2]),r&&o.scale.set(r[0],r[1],r[2]),o.updateMatrix();const l=o.geometry.clone();l.applyMatrix4(o.matrix),o.geometry=l,o.renderOrder=1/0,o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),i.add(o)}return i};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=j(V)),this.add(this.gizmo.rotate=j(Y)),this.add(this.gizmo.scale=j(I)),this.add(this.picker.translate=j(S)),this.add(this.picker.rotate=j(Z)),this.add(this.picker.scale=j(A)),this.add(this.helper.translate=j(E)),this.add(this.helper.rotate=j(X)),this.add(this.helper.scale=j(z)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class a extends e.Mesh{constructor(){super(new e.PlaneGeometry(1e5,1e5,2,2),new e.MeshBasicMaterial({visible:!1,wireframe:!0,side:e.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),n.default(this,"isTransformControlsPlane",!0),n.default(this,"type","TransformControlsPlane"),n.default(this,"unitX",new e.Vector3(1,0,0)),n.default(this,"unitY",new e.Vector3(0,1,0)),n.default(this,"unitZ",new e.Vector3(0,0,1)),n.default(this,"tempVector",new e.Vector3),n.default(this,"dirVector",new e.Vector3),n.default(this,"alignVector",new e.Vector3),n.default(this,"tempMatrix",new e.Matrix4),n.default(this,"identityQuaternion",new e.Quaternion),n.default(this,"cameraQuaternion",new e.Quaternion),n.default(this,"worldPosition",new e.Vector3),n.default(this,"worldQuaternion",new e.Quaternion),n.default(this,"eye",new e.Vector3),n.default(this,"axis",null),n.default(this,"mode","translate"),n.default(this,"space","world"),n.default(this,"updateMatrixWorld",(()=>{let t=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(t="local"),this.unitX.set(1,0,0).applyQuaternion("local"===t?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion("local"===t?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion("local"===t?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0)}break;case"rotate":default:this.dirVector.set(0,0,0)}0===this.dirVector.length()?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()}))}}exports.TransformControls=o,exports.TransformControlsGizmo=s,exports.TransformControlsPlane=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@babel/runtime/helpers/defineProperty"),e=require("three");function i(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=i(t);class o extends e.Object3D{constructor(t,i){super(),n.default(this,"isTransformControls",!0),n.default(this,"visible",!1),n.default(this,"domElement",void 0),n.default(this,"raycaster",new e.Raycaster),n.default(this,"gizmo",void 0),n.default(this,"plane",void 0),n.default(this,"tempVector",new e.Vector3),n.default(this,"tempVector2",new e.Vector3),n.default(this,"tempQuaternion",new e.Quaternion),n.default(this,"unit",{X:new e.Vector3(1,0,0),Y:new e.Vector3(0,1,0),Z:new e.Vector3(0,0,1)}),n.default(this,"pointStart",new e.Vector3),n.default(this,"pointEnd",new e.Vector3),n.default(this,"offset",new e.Vector3),n.default(this,"rotationAxis",new e.Vector3),n.default(this,"startNorm",new e.Vector3),n.default(this,"endNorm",new e.Vector3),n.default(this,"rotationAngle",0),n.default(this,"cameraPosition",new e.Vector3),n.default(this,"cameraQuaternion",new e.Quaternion),n.default(this,"cameraScale",new e.Vector3),n.default(this,"parentPosition",new e.Vector3),n.default(this,"parentQuaternion",new e.Quaternion),n.default(this,"parentQuaternionInv",new e.Quaternion),n.default(this,"parentScale",new e.Vector3),n.default(this,"worldPositionStart",new e.Vector3),n.default(this,"worldQuaternionStart",new e.Quaternion),n.default(this,"worldScaleStart",new e.Vector3),n.default(this,"worldPosition",new e.Vector3),n.default(this,"worldQuaternion",new e.Quaternion),n.default(this,"worldQuaternionInv",new e.Quaternion),n.default(this,"worldScale",new e.Vector3),n.default(this,"eye",new e.Vector3),n.default(this,"positionStart",new e.Vector3),n.default(this,"quaternionStart",new e.Quaternion),n.default(this,"scaleStart",new e.Vector3),n.default(this,"camera",void 0),n.default(this,"object",void 0),n.default(this,"enabled",!0),n.default(this,"axis",null),n.default(this,"mode","translate"),n.default(this,"translationSnap",null),n.default(this,"rotationSnap",null),n.default(this,"scaleSnap",null),n.default(this,"space","world"),n.default(this,"size",1),n.default(this,"dragging",!1),n.default(this,"showX",!0),n.default(this,"showY",!0),n.default(this,"showZ",!0),n.default(this,"changeEvent",{type:"change"}),n.default(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),n.default(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),n.default(this,"objectChangeEvent",{type:"objectChange"}),n.default(this,"intersectObjectWithRay",((t,e,i)=>{const n=e.intersectObject(t,!0);for(let t=0;t<n.length;t++)if(n[t].object.visible||i)return n[t];return!1})),n.default(this,"attach",(t=>(this.object=t,this.visible=!0,this))),n.default(this,"detach",(()=>(this.object=void 0,this.visible=!1,this.axis=null,this))),n.default(this,"updateMatrixWorld",(()=>{void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()})),n.default(this,"pointerHover",(t=>{if(void 0===this.object||!0===this.dragging)return;this.raycaster.setFromCamera(t,this.camera);const e=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);this.axis=e?e.object.name:null})),n.default(this,"pointerDown",(t=>{if(void 0!==this.object&&!0!==this.dragging&&0===t.button&&null!==this.axis){this.raycaster.setFromCamera(t,this.camera);const e=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(e){let t=this.space;if("scale"===this.mode?t="local":"E"!==this.axis&&"XYZE"!==this.axis&&"XYZ"!==this.axis||(t="world"),"local"===t&&"rotate"===this.mode){const t=this.rotationSnap;"X"===this.axis&&t&&(this.object.rotation.x=Math.round(this.object.rotation.x/t)*t),"Y"===this.axis&&t&&(this.object.rotation.y=Math.round(this.object.rotation.y/t)*t),"Z"===this.axis&&t&&(this.object.rotation.z=Math.round(this.object.rotation.z/t)*t)}this.object.updateMatrixWorld(),this.object.parent&&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,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}})),n.default(this,"pointerMove",(t=>{const e=this.axis,i=this.mode,n=this.object;let o=this.space;if("scale"===i?o="local":"E"!==e&&"XYZE"!==e&&"XYZ"!==e||(o="world"),void 0===n||null===e||!1===this.dragging||-1!==t.button)return;this.raycaster.setFromCamera(t,this.camera);const s=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(s){if(this.pointEnd.copy(s.point).sub(this.worldPositionStart),"translate"===i)this.offset.copy(this.pointEnd).sub(this.pointStart),"local"===o&&"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"===o&&"XYZ"!==e?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),n.position.copy(this.offset).add(this.positionStart),this.translationSnap&&("local"===o&&(n.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),-1!==e.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this.quaternionStart)),"world"===o&&(n.parent&&n.position.add(this.tempVector.setFromMatrixPosition(n.parent.matrixWorld)),-1!==e.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(this.tempVector.setFromMatrixPosition(n.parent.matrixWorld))));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),this.tempVector2.set(t,t,t)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),-1===e.search("X")&&(this.tempVector2.x=1),-1===e.search("Y")&&(this.tempVector2.y=1),-1===e.search("Z")&&(this.tempVector2.z=1);n.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(-1!==e.search("X")&&(this.object.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Z")&&(n.scale.z=Math.round(n.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(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));"E"===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):"XYZE"===e?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*t):"X"!==e&&"Y"!==e&&"Z"!==e||(this.rotationAxis.copy(this.unit[e]),this.tempVector.copy(this.unit[e]),"local"===o&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*t),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===o&&"E"!==e&&"XYZE"!==e?(n.quaternion.copy(this.quaternionStart),n.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),n.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}})),n.default(this,"pointerUp",(t=>{0===t.button&&(this.dragging&&null!==this.axis&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)})),n.default(this,"getPointer",(t=>{var e;if(this.domElement&&null!==(e=this.domElement.ownerDocument)&&void 0!==e&&e.pointerLockElement)return{x:0,y:0,button:t.button};{var i;const e=t.changedTouches?t.changedTouches[0]:t,n=null===(i=this.domElement)||void 0===i?void 0:i.getBoundingClientRect();return{x:(e.clientX-n.left)/n.width*2-1,y:-(e.clientY-n.top)/n.height*2+1,button:t.button}}})),n.default(this,"onPointerHover",(t=>{if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(t))}})),n.default(this,"onPointerDown",(t=>{this.enabled&&this.domElement&&(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(t)),this.pointerDown(this.getPointer(t)))})),n.default(this,"onPointerMove",(t=>{this.enabled&&this.pointerMove(this.getPointer(t))})),n.default(this,"onPointerUp",(t=>{this.enabled&&this.domElement&&(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(t)))})),n.default(this,"getMode",(()=>this.mode)),n.default(this,"setMode",(t=>{this.mode=t})),n.default(this,"setTranslationSnap",(t=>{this.translationSnap=t})),n.default(this,"setRotationSnap",(t=>{this.rotationSnap=t})),n.default(this,"setScaleSnap",(t=>{this.scaleSnap=t})),n.default(this,"setSize",(t=>{this.size=t})),n.default(this,"setSpace",(t=>{this.space=t})),n.default(this,"update",(()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")})),n.default(this,"connect",(t=>{t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=t,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)})),n.default(this,"dispose",(()=>{var t,e,i,n,o,s;null===(t=this.domElement)||void 0===t||t.removeEventListener("pointerdown",this.onPointerDown),null===(e=this.domElement)||void 0===e||e.removeEventListener("pointermove",this.onPointerHover),null===(i=this.domElement)||void 0===i||null===(n=i.ownerDocument)||void 0===n||n.removeEventListener("pointermove",this.onPointerMove),null===(o=this.domElement)||void 0===o||null===(s=o.ownerDocument)||void 0===s||s.removeEventListener("pointerup",this.onPointerUp),this.traverse((t=>{const e=t;e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))})),this.domElement=i,this.camera=t,this.gizmo=new s,this.add(this.gizmo),this.plane=new a,this.add(this.plane);const o=(t,e)=>{let i=e;Object.defineProperty(this,t,{get:function(){return void 0!==i?i:e},set:function(e){i!==e&&(i=e,this.plane[t]=e,this.gizmo[t]=e,this.dispatchEvent({type:t+"-changed",value:e}),this.dispatchEvent(this.changeEvent))}}),this[t]=e,this.plane[t]=e,this.gizmo[t]=e};o("camera",this.camera),o("object",this.object),o("enabled",this.enabled),o("axis",this.axis),o("mode",this.mode),o("translationSnap",this.translationSnap),o("rotationSnap",this.rotationSnap),o("scaleSnap",this.scaleSnap),o("space",this.space),o("size",this.size),o("dragging",this.dragging),o("showX",this.showX),o("showY",this.showY),o("showZ",this.showZ),o("worldPosition",this.worldPosition),o("worldPositionStart",this.worldPositionStart),o("worldQuaternion",this.worldQuaternion),o("worldQuaternionStart",this.worldQuaternionStart),o("cameraPosition",this.cameraPosition),o("cameraQuaternion",this.cameraQuaternion),o("pointStart",this.pointStart),o("pointEnd",this.pointEnd),o("rotationAxis",this.rotationAxis),o("rotationAngle",this.rotationAngle),o("eye",this.eye),void 0!==i&&this.connect(i)}}class s extends e.Object3D{constructor(){super(),n.default(this,"isTransformControlsGizmo",!0),n.default(this,"type","TransformControlsGizmo"),n.default(this,"tempVector",new e.Vector3(0,0,0)),n.default(this,"tempEuler",new e.Euler),n.default(this,"alignVector",new e.Vector3(0,1,0)),n.default(this,"zeroVector",new e.Vector3(0,0,0)),n.default(this,"lookAtMatrix",new e.Matrix4),n.default(this,"tempQuaternion",new e.Quaternion),n.default(this,"tempQuaternion2",new e.Quaternion),n.default(this,"identityQuaternion",new e.Quaternion),n.default(this,"unitX",new e.Vector3(1,0,0)),n.default(this,"unitY",new e.Vector3(0,1,0)),n.default(this,"unitZ",new e.Vector3(0,0,1)),n.default(this,"gizmo",void 0),n.default(this,"picker",void 0),n.default(this,"helper",void 0),n.default(this,"rotationAxis",new e.Vector3),n.default(this,"cameraPosition",new e.Vector3),n.default(this,"worldPositionStart",new e.Vector3),n.default(this,"worldQuaternionStart",new e.Quaternion),n.default(this,"worldPosition",new e.Vector3),n.default(this,"worldQuaternion",new e.Quaternion),n.default(this,"eye",new e.Vector3),n.default(this,"camera",null),n.default(this,"enabled",!0),n.default(this,"axis",null),n.default(this,"mode","translate"),n.default(this,"space","world"),n.default(this,"size",1),n.default(this,"dragging",!1),n.default(this,"showX",!0),n.default(this,"showY",!0),n.default(this,"showZ",!0),n.default(this,"updateMatrixWorld",(()=>{let t=this.space;"scale"===this.mode&&(t="local");const i="local"===t?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;let n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let t=0;t<n.length;t++){const o=n[t];let s;if(o.visible=!0,o.rotation.set(0,0,0),o.position.copy(this.worldPosition),s=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(s*this.size/7),"helper"!==o.tag){if(o.quaternion.copy(i),"translate"===this.mode||"scale"===this.mode){const t=.99,e=.2,n=0;"X"!==o.name&&"XYZX"!==o.name||Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(i).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"Y"!==o.name&&"XYZY"!==o.name||Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(i).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"Z"!==o.name&&"XYZZ"!==o.name||Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(i).dot(this.eye))>t&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"XY"===o.name&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(i).dot(this.eye))<e&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"YZ"===o.name&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(i).dot(this.eye))<e&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),"XZ"===o.name&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(i).dot(this.eye))<e&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),-1!==o.name.search("X")&&(this.alignVector.copy(this.unitX).applyQuaternion(i).dot(this.eye)<n?"fwd"===o.tag?o.visible=!1:o.scale.x*=-1:"bwd"===o.tag&&(o.visible=!1)),-1!==o.name.search("Y")&&(this.alignVector.copy(this.unitY).applyQuaternion(i).dot(this.eye)<n?"fwd"===o.tag?o.visible=!1:o.scale.y*=-1:"bwd"===o.tag&&(o.visible=!1)),-1!==o.name.search("Z")&&(this.alignVector.copy(this.unitZ).applyQuaternion(i).dot(this.eye)<n?"fwd"===o.tag?o.visible=!1:o.scale.z*=-1:"bwd"===o.tag&&(o.visible=!1))}else"rotate"===this.mode&&(this.tempQuaternion2.copy(i),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(i).invert()),-1!==o.name.search("E")&&o.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),"X"===o.name&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),o.quaternion.copy(this.tempQuaternion)),"Y"===o.name&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),o.quaternion.copy(this.tempQuaternion)),"Z"===o.name&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),o.quaternion.copy(this.tempQuaternion)));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),o.material.tempOpacity=o.material.tempOpacity||o.material.opacity,o.material.tempColor=o.material.tempColor||o.material.color.clone(),o.material.color.copy(o.material.tempColor),o.material.opacity=o.material.tempOpacity,this.enabled?this.axis&&(o.name===this.axis||this.axis.split("").some((function(t){return o.name===t}))?(o.material.opacity=1,o.material.color.lerp(new e.Color(1,1,1),.5)):(o.material.opacity*=.25,o.material.color.lerp(new e.Color(1,1,1),.5))):(o.material.opacity*=.5,o.material.color.lerp(new e.Color(1,1,1),.5))}else o.visible=!1,"AXIS"===o.name?(o.position.copy(this.worldPositionStart),o.visible=!!this.axis,"X"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),o.quaternion.copy(i).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),"Y"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),o.quaternion.copy(i).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),"Z"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),o.quaternion.copy(i).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),"XYZE"===this.axis&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),o.quaternion.multiply(this.tempQuaternion),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),this.tempVector.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(this.tempVector),o.visible=this.dragging):(o.quaternion.copy(i),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=-1!==this.axis.search(o.name)))}super.updateMatrixWorld()}));const t=new e.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:e.DoubleSide,fog:!1,toneMapped:!1}),i=new e.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),o=t.clone();o.opacity=.15;const s=t.clone();s.opacity=.33;const a=t.clone();a.color.set(16711680);const r=t.clone();r.color.set(65280);const h=t.clone();h.color.set(255);const l=t.clone();l.opacity=.25;const c=l.clone();c.color.set(16776960);const d=l.clone();d.color.set(65535);const u=l.clone();u.color.set(16711935);t.clone().color.set(16776960);const p=i.clone();p.color.set(16711680);const m=i.clone();m.color.set(65280);const w=i.clone();w.color.set(255);const y=i.clone();y.color.set(65535);const f=i.clone();f.color.set(16711935);const M=i.clone();M.color.set(16776960);const g=i.clone();g.color.set(7895160);const b=M.clone();b.opacity=.25;const v=new e.CylinderGeometry(0,.05,.2,12,1,!1),P=new e.BoxGeometry(.125,.125,.125),Q=new e.BufferGeometry;Q.setAttribute("position",new e.Float32BufferAttribute([0,0,0,1,0,0],3));const x=(t,i)=>{const n=new e.BufferGeometry,o=[];for(let e=0;e<=64*i;++e)o.push(0,Math.cos(e/32*Math.PI)*t,Math.sin(e/32*Math.PI)*t);return n.setAttribute("position",new e.Float32BufferAttribute(o,3)),n},V={X:[[new e.Mesh(v,a),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new e.Mesh(v,a),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new e.Line(Q,p)]],Y:[[new e.Mesh(v,r),[0,1,0],null,null,"fwd"],[new e.Mesh(v,r),[0,1,0],[Math.PI,0,0],null,"bwd"],[new e.Line(Q,m),null,[0,0,Math.PI/2]]],Z:[[new e.Mesh(v,h),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new e.Mesh(v,h),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new e.Line(Q,w),null,[0,-Math.PI/2,0]]],XYZ:[[new e.Mesh(new e.OctahedronGeometry(.1,0),l.clone()),[0,0,0],[0,0,0]]],XY:[[new e.Mesh(new e.PlaneGeometry(.295,.295),c.clone()),[.15,.15,0]],[new e.Line(Q,M),[.18,.3,0],null,[.125,1,1]],[new e.Line(Q,M),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new e.Mesh(new e.PlaneGeometry(.295,.295),d.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new e.Line(Q,y),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new e.Line(Q,y),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new e.Mesh(new e.PlaneGeometry(.295,.295),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new e.Line(Q,f),[.18,0,.3],null,[.125,1,1]],[new e.Line(Q,f),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},S={X:[[new e.Mesh(new e.CylinderGeometry(.2,0,1,4,1,!1),o),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new e.Mesh(new e.CylinderGeometry(.2,0,1,4,1,!1),o),[0,.6,0]]],Z:[[new e.Mesh(new e.CylinderGeometry(.2,0,1,4,1,!1),o),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new e.Mesh(new e.OctahedronGeometry(.2,0),o)]],XY:[[new e.Mesh(new e.PlaneGeometry(.4,.4),o),[.2,.2,0]]],YZ:[[new e.Mesh(new e.PlaneGeometry(.4,.4),o),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new e.Mesh(new e.PlaneGeometry(.4,.4),o),[.2,0,.2],[-Math.PI/2,0,0]]]},E={START:[[new e.Mesh(new e.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new e.Mesh(new e.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new e.Line((()=>{const t=new e.BufferGeometry;return t.setAttribute("position",new e.Float32BufferAttribute([0,0,0,1,1,1],3)),t})(),s),null,null,null,"helper"]],X:[[new e.Line(Q,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new e.Line(Q,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new e.Line(Q,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},Y={X:[[new e.Line(x(1,.5),p)],[new e.Mesh(new e.OctahedronGeometry(.04,0),a),[0,0,.99],null,[1,3,1]]],Y:[[new e.Line(x(1,.5),m),null,[0,0,-Math.PI/2]],[new e.Mesh(new e.OctahedronGeometry(.04,0),r),[0,0,.99],null,[3,1,1]]],Z:[[new e.Line(x(1,.5),w),null,[0,Math.PI/2,0]],[new e.Mesh(new e.OctahedronGeometry(.04,0),h),[.99,0,0],null,[1,3,1]]],E:[[new e.Line(x(1.25,1),b),null,[0,Math.PI/2,0]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new e.Mesh(new e.CylinderGeometry(.03,0,.15,4,1,!1),b),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new e.Line(x(1,1),g),null,[0,Math.PI/2,0]]]},X={AXIS:[[new e.Line(Q,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},Z={X:[[new e.Mesh(new e.TorusGeometry(1,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new e.Mesh(new e.TorusGeometry(1,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new e.Mesh(new e.TorusGeometry(1,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new e.Mesh(new e.TorusGeometry(1.25,.1,2,24),o)]],XYZE:[[new e.Mesh(new e.SphereGeometry(.7,10,8),o)]]},I={X:[[new e.Mesh(P,a),[.8,0,0],[0,0,-Math.PI/2]],[new e.Line(Q,p),null,null,[.8,1,1]]],Y:[[new e.Mesh(P,r),[0,.8,0]],[new e.Line(Q,m),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new e.Mesh(P,h),[0,0,.8],[Math.PI/2,0,0]],[new e.Line(Q,w),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new e.Mesh(P,c),[.85,.85,0],null,[2,2,.2]],[new e.Line(Q,M),[.855,.98,0],null,[.125,1,1]],[new e.Line(Q,M),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new e.Mesh(P,d),[0,.85,.85],null,[.2,2,2]],[new e.Line(Q,y),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new e.Line(Q,y),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new e.Mesh(P,u),[.85,0,.85],null,[2,.2,2]],[new e.Line(Q,f),[.855,0,.98],null,[.125,1,1]],[new e.Line(Q,f),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new e.Mesh(new e.BoxGeometry(.125,.125,.125),l.clone()),[1.1,0,0]]],XYZY:[[new e.Mesh(new e.BoxGeometry(.125,.125,.125),l.clone()),[0,1.1,0]]],XYZZ:[[new e.Mesh(new e.BoxGeometry(.125,.125,.125),l.clone()),[0,0,1.1]]]},A={X:[[new e.Mesh(new e.CylinderGeometry(.2,0,.8,4,1,!1),o),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new e.Mesh(new e.CylinderGeometry(.2,0,.8,4,1,!1),o),[0,.5,0]]],Z:[[new e.Mesh(new e.CylinderGeometry(.2,0,.8,4,1,!1),o),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new e.Mesh(P,o),[.85,.85,0],null,[3,3,.2]]],YZ:[[new e.Mesh(P,o),[0,.85,.85],null,[.2,3,3]]],XZ:[[new e.Mesh(P,o),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),o),[1.1,0,0]]],XYZY:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),o),[0,1.1,0]]],XYZZ:[[new e.Mesh(new e.BoxGeometry(.2,.2,.2),o),[0,0,1.1]]]},z={X:[[new e.Line(Q,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new e.Line(Q,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new e.Line(Q,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},j=t=>{const i=new e.Object3D;for(let e in t)for(let n=t[e].length;n--;){const o=t[e][n][0].clone(),s=t[e][n][1],a=t[e][n][2],r=t[e][n][3],h=t[e][n][4];o.name=e,o.tag=h,s&&o.position.set(s[0],s[1],s[2]),a&&o.rotation.set(a[0],a[1],a[2]),r&&o.scale.set(r[0],r[1],r[2]),o.updateMatrix();const l=o.geometry.clone();l.applyMatrix4(o.matrix),o.geometry=l,o.renderOrder=1/0,o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),i.add(o)}return i};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=j(V)),this.add(this.gizmo.rotate=j(Y)),this.add(this.gizmo.scale=j(I)),this.add(this.picker.translate=j(S)),this.add(this.picker.rotate=j(Z)),this.add(this.picker.scale=j(A)),this.add(this.helper.translate=j(E)),this.add(this.helper.rotate=j(X)),this.add(this.helper.scale=j(z)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class a extends e.Mesh{constructor(){super(new e.PlaneGeometry(1e5,1e5,2,2),new e.MeshBasicMaterial({visible:!1,wireframe:!0,side:e.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),n.default(this,"isTransformControlsPlane",!0),n.default(this,"type","TransformControlsPlane"),n.default(this,"unitX",new e.Vector3(1,0,0)),n.default(this,"unitY",new e.Vector3(0,1,0)),n.default(this,"unitZ",new e.Vector3(0,0,1)),n.default(this,"tempVector",new e.Vector3),n.default(this,"dirVector",new e.Vector3),n.default(this,"alignVector",new e.Vector3),n.default(this,"tempMatrix",new e.Matrix4),n.default(this,"identityQuaternion",new e.Quaternion),n.default(this,"cameraQuaternion",new e.Quaternion),n.default(this,"worldPosition",new e.Vector3),n.default(this,"worldQuaternion",new e.Quaternion),n.default(this,"eye",new e.Vector3),n.default(this,"axis",null),n.default(this,"mode","translate"),n.default(this,"space","world"),n.default(this,"updateMatrixWorld",(()=>{let t=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(t="local"),this.unitX.set(1,0,0).applyQuaternion("local"===t?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion("local"===t?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion("local"===t?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0)}break;case"rotate":default:this.dirVector.set(0,0,0)}0===this.dirVector.length()?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()}))}}exports.TransformControls=o,exports.TransformControlsGizmo=s,exports.TransformControlsPlane=a;
@@ -58,7 +58,7 @@ declare class TransformControls<TCamera extends Camera = Camera> extends Object3
58
58
  private mouseDownEvent;
59
59
  private mouseUpEvent;
60
60
  private objectChangeEvent;
61
- constructor(camera: TCamera, domElement: HTMLElement);
61
+ constructor(camera: TCamera, domElement: HTMLElement | undefined);
62
62
  private intersectObjectWithRay;
63
63
  attach: (object: Object3D) => this;
64
64
  detach: () => this;
@@ -80,6 +80,7 @@ declare class TransformControls<TCamera extends Camera = Camera> extends Object3
80
80
  setSize: (size: number) => void;
81
81
  setSpace: (space: string) => void;
82
82
  update: () => void;
83
+ connect: (domElement: HTMLElement) => void;
83
84
  dispose: () => void;
84
85
  }
85
86
  declare type TransformControlsGizmoPrivateGizmos = {
@@ -3,7 +3,7 @@ import { Object3D, Raycaster, Vector3, Quaternion, Euler, Matrix4, Color, MeshBa
3
3
 
4
4
  class TransformControls extends Object3D {
5
5
  // events
6
- constructor(camera, domElement) {
6
+ constructor(camera, _domElement) {
7
7
  super();
8
8
 
9
9
  _defineProperty(this, "isTransformControls", true);
@@ -436,12 +436,10 @@ class TransformControls extends Object3D {
436
436
  });
437
437
 
438
438
  _defineProperty(this, "onPointerDown", event => {
439
- var _this$domElement$owne2;
440
-
441
- if (!this.enabled) return;
439
+ if (!this.enabled || !this.domElement) return;
442
440
  this.domElement.style.touchAction = 'none'; // disable touch scroll
443
441
 
444
- (_this$domElement$owne2 = this.domElement.ownerDocument) === null || _this$domElement$owne2 === void 0 ? void 0 : _this$domElement$owne2.addEventListener('pointermove', this.onPointerMove);
442
+ this.domElement.ownerDocument.addEventListener('pointermove', this.onPointerMove);
445
443
  this.pointerHover(this.getPointer(event));
446
444
  this.pointerDown(this.getPointer(event));
447
445
  });
@@ -452,11 +450,9 @@ class TransformControls extends Object3D {
452
450
  });
453
451
 
454
452
  _defineProperty(this, "onPointerUp", event => {
455
- var _this$domElement$owne3;
456
-
457
- if (!this.enabled) return;
453
+ if (!this.enabled || !this.domElement) return;
458
454
  this.domElement.style.touchAction = '';
459
- (_this$domElement$owne3 = this.domElement.ownerDocument) === null || _this$domElement$owne3 === void 0 ? void 0 : _this$domElement$owne3.removeEventListener('pointermove', this.onPointerMove);
455
+ this.domElement.ownerDocument.removeEventListener('pointermove', this.onPointerMove);
460
456
  this.pointerUp(this.getPointer(event));
461
457
  });
462
458
 
@@ -490,13 +486,24 @@ class TransformControls extends Object3D {
490
486
  console.warn('THREE.TransformControls: update function has no more functionality and therefore has been deprecated.');
491
487
  });
492
488
 
489
+ _defineProperty(this, "connect", domElement => {
490
+ if (domElement === document) {
491
+ console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');
492
+ }
493
+
494
+ this.domElement = domElement;
495
+ this.domElement.addEventListener('pointerdown', this.onPointerDown);
496
+ this.domElement.addEventListener('pointermove', this.onPointerHover);
497
+ this.domElement.ownerDocument.addEventListener('pointerup', this.onPointerUp);
498
+ });
499
+
493
500
  _defineProperty(this, "dispose", () => {
494
- var _this$domElement$owne4, _this$domElement$owne5;
501
+ var _this$domElement2, _this$domElement3, _this$domElement4, _this$domElement4$own, _this$domElement5, _this$domElement5$own;
495
502
 
496
- this.domElement.removeEventListener('pointerdown', this.onPointerDown);
497
- this.domElement.removeEventListener('pointermove', this.onPointerHover);
498
- (_this$domElement$owne4 = this.domElement.ownerDocument) === null || _this$domElement$owne4 === void 0 ? void 0 : _this$domElement$owne4.removeEventListener('pointermove', this.onPointerMove);
499
- (_this$domElement$owne5 = this.domElement.ownerDocument) === null || _this$domElement$owne5 === void 0 ? void 0 : _this$domElement$owne5.removeEventListener('pointerup', this.onPointerUp);
503
+ (_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 ? void 0 : _this$domElement2.removeEventListener('pointerdown', this.onPointerDown);
504
+ (_this$domElement3 = this.domElement) === null || _this$domElement3 === void 0 ? void 0 : _this$domElement3.removeEventListener('pointermove', this.onPointerHover);
505
+ (_this$domElement4 = this.domElement) === null || _this$domElement4 === void 0 ? void 0 : (_this$domElement4$own = _this$domElement4.ownerDocument) === null || _this$domElement4$own === void 0 ? void 0 : _this$domElement4$own.removeEventListener('pointermove', this.onPointerMove);
506
+ (_this$domElement5 = this.domElement) === null || _this$domElement5 === void 0 ? void 0 : (_this$domElement5$own = _this$domElement5.ownerDocument) === null || _this$domElement5$own === void 0 ? void 0 : _this$domElement5$own.removeEventListener('pointerup', this.onPointerUp);
500
507
  this.traverse(child => {
501
508
  const mesh = child;
502
509
 
@@ -510,12 +517,7 @@ class TransformControls extends Object3D {
510
517
  });
511
518
  });
512
519
 
513
- if (domElement === undefined) {
514
- console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.');
515
- this.domElement = document;
516
- }
517
-
518
- this.domElement = domElement;
520
+ this.domElement = _domElement;
519
521
  this.camera = camera;
520
522
  this.gizmo = new TransformControlsGizmo();
521
523
  this.add(this.gizmo);
@@ -573,12 +575,9 @@ class TransformControls extends Object3D {
573
575
  defineProperty('pointEnd', this.pointEnd);
574
576
  defineProperty('rotationAxis', this.rotationAxis);
575
577
  defineProperty('rotationAngle', this.rotationAngle);
576
- defineProperty('eye', this.eye);
577
- {
578
- domElement.addEventListener('pointerdown', this.onPointerDown);
579
- domElement.addEventListener('pointermove', this.onPointerHover);
580
- this.domElement.ownerDocument.addEventListener('pointerup', this.onPointerUp);
581
- }
578
+ defineProperty('eye', this.eye); // connect events
579
+
580
+ if (_domElement !== undefined) this.connect(_domElement);
582
581
  }
583
582
 
584
583
  }
@@ -138,8 +138,8 @@ class TeapotGeometry extends BufferGeometry {
138
138
  mst.transpose(); // internal function: test if triangle has any matching vertices;
139
139
  // if so, don't save triangle, since it won't display anything.
140
140
 
141
- const notDegenerate = (vtx1, vtx2, vtx3) => // if any vertex matches, return false
142
- !(vertices[vtx1 * 3] === vertices[vtx2 * 3] && vertices[vtx1 * 3 + 1] === vertices[vtx2 * 3 + 1] && vertices[vtx1 * 3 + 2] === vertices[vtx2 * 3 + 2] || vertices[vtx1 * 3] === vertices[vtx3 * 3] && vertices[vtx1 * 3 + 1] === vertices[vtx3 * 3 + 1] && vertices[vtx1 * 3 + 2] === vertices[vtx3 * 3 + 2] || vertices[vtx2 * 3] === vertices[vtx3 * 3] && vertices[vtx2 * 3 + 1] === vertices[vtx3 * 3 + 1] && vertices[vtx2 * 3 + 2] === vertices[vtx3 * 3 + 2]);
141
+ const notDegenerate = (vtx1, vtx2, vtx3 // if any vertex matches, return false
142
+ ) => !(vertices[vtx1 * 3] === vertices[vtx2 * 3] && vertices[vtx1 * 3 + 1] === vertices[vtx2 * 3 + 1] && vertices[vtx1 * 3 + 2] === vertices[vtx2 * 3 + 2] || vertices[vtx1 * 3] === vertices[vtx3 * 3] && vertices[vtx1 * 3 + 1] === vertices[vtx3 * 3 + 1] && vertices[vtx1 * 3 + 2] === vertices[vtx3 * 3 + 2] || vertices[vtx2 * 3] === vertices[vtx3 * 3] && vertices[vtx2 * 3 + 1] === vertices[vtx3 * 3 + 1] && vertices[vtx2 * 3 + 2] === vertices[vtx3 * 3 + 2]);
143
143
 
144
144
  for (i = 0; i < 3; i++) {
145
145
  mgm[i] = new Matrix4();
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three");class t extends e.ExtrudeGeometry{constructor(e,t){const{bevelEnabled:r=!1,bevelSize:s=8,bevelThickness:o=10,font:l,height:i=50,size:n=100,...b}=t;super(l.generateShapes(e,n),{...b,bevelEnabled:r,bevelSize:s,bevelThickness:o,depth:i}),this.type="TextGeometry"}}exports.TextBufferGeometry=t,exports.TextGeometry=t;
@@ -0,0 +1,16 @@
1
+ import { ExtrudeGeometry } from 'three';
2
+ import type { Font } from '../loaders/FontLoader';
3
+ export declare type TextGeometryParameters = {
4
+ bevelEnabled?: boolean;
5
+ bevelOffset?: number;
6
+ bevelSize?: number;
7
+ bevelThickness?: number;
8
+ curveSegments?: number;
9
+ font: Font;
10
+ height?: number;
11
+ size?: number;
12
+ };
13
+ export declare class TextGeometry extends ExtrudeGeometry {
14
+ constructor(text: string, parameters: TextGeometryParameters);
15
+ }
16
+ export { TextGeometry as TextBufferGeometry };
@@ -0,0 +1,26 @@
1
+ import { ExtrudeGeometry } from 'three';
2
+
3
+ class TextGeometry extends ExtrudeGeometry {
4
+ constructor(text, parameters) {
5
+ const {
6
+ bevelEnabled = false,
7
+ bevelSize = 8,
8
+ bevelThickness = 10,
9
+ font,
10
+ height = 50,
11
+ size = 100,
12
+ ...rest
13
+ } = parameters;
14
+ const shapes = font.generateShapes(text, size);
15
+ super(shapes, { ...rest,
16
+ bevelEnabled,
17
+ bevelSize,
18
+ bevelThickness,
19
+ depth: height
20
+ });
21
+ this.type = 'TextGeometry';
22
+ }
23
+
24
+ }
25
+
26
+ export { TextGeometry as TextBufferGeometry, TextGeometry };