8 lines
12 KiB
JavaScript
8 lines
12 KiB
JavaScript
|
|
/**
|
||
|
|
* Minified by jsDelivr using Terser v5.19.2.
|
||
|
|
* Original file: /npm/three@0.128.0/examples/js/controls/OrbitControls.js
|
||
|
|
*
|
||
|
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||
|
|
*/
|
||
|
|
!function(){const e={type:"change"},t={type:"start"},n={type:"end"};class o extends THREE.EventDispatcher{constructor(o,a){super(),void 0===a&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),a===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=o,this.domElement=a,this.enabled=!0,this.target=new THREE.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:THREE.MOUSE.ROTATE,MIDDLE:THREE.MOUSE.DOLLY,RIGHT:THREE.MOUSE.PAN},this.touches={ONE:THREE.TOUCH.ROTATE,TWO:THREE.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return u.phi},this.getAzimuthalAngle=function(){return u.theta},this.listenToKeyEvents=function(e){e.addEventListener("keydown",X),this._domElementKeyEvents=e},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(e),i.update(),s=c.NONE},this.update=function(){const t=new THREE.Vector3,n=(new THREE.Quaternion).setFromUnitVectors(o.up,new THREE.Vector3(0,1,0)),a=n.clone().invert(),p=new THREE.Vector3,d=new THREE.Quaternion,b=2*Math.PI;return function(){const o=i.object.position;t.copy(o).sub(i.target),t.applyQuaternion(n),u.setFromVector3(t),i.autoRotate&&s===c.NONE&&v(2*Math.PI/60/60*i.autoRotateSpeed),i.enableDamping?(u.theta+=l.theta*i.dampingFactor,u.phi+=l.phi*i.dampingFactor):(u.theta+=l.theta,u.phi+=l.phi);let T=i.minAzimuthAngle,f=i.maxAzimuthAngle;return isFinite(T)&&isFinite(f)&&(T<-Math.PI?T+=b:T>Math.PI&&(T-=b),f<-Math.PI?f+=b:f>Math.PI&&(f-=b),u.theta=T<=f?Math.max(T,Math.min(f,u.theta)):u.theta>(T+f)/2?Math.max(T,u.theta):Math.min(f,u.theta)),u.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,u.phi)),u.makeSafe(),u.radius*=m,u.radius=Math.max(i.minDistance,Math.min(i.maxDistance,u.radius)),!0===i.enableDamping?i.target.addScaledVector(h,i.dampingFactor):i.target.add(h),t.setFromSpherical(u),t.applyQuaternion(a),o.copy(i.target).add(t),i.object.lookAt(i.target),!0===i.enableDamping?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,h.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),h.set(0,0,0)),m=1,!!(E||p.distanceToSquared(i.object.position)>r||8*(1-d.dot(i.object.quaternion))>r)&&(i.dispatchEvent(e),p.copy(i.object.position),d.copy(i.object.quaternion),E=!1,!0)}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",B),i.domElement.removeEventListener("pointerdown",V),i.domElement.removeEventListener("wheel",I),i.domElement.removeEventListener("touchstart",F),i.domElement.removeEventListener("touchend",K),i.domElement.removeEventListener("touchmove",Z),i.domElement.ownerDocument.removeEventListener("pointermove",_),i.domElement.ownerDocument.removeEventListener("pointerup",z),null!==i._domElementKeyEvents&&i._domElementKeyEvents.removeEventListener("keydown",X)};const i=this,c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=c.NONE;const r=1e-6,u=new THREE.Spherical,l=new THREE.Spherical;let m=1;const h=new THREE.Vector3;let E=!1;const p=new THREE.Vector2,d=new THREE.Vector2,b=new THREE.Vector2,T=new THREE.Vector2,f=new THREE.Vector2,O=new THREE.Vector2,g=new THREE.Vector2,R=new THREE.Vector2,H=new THREE.Vector2;function y(){return Math.pow(.95,i.zoomSpeed)}function
|
||
|
|
//# sourceMappingURL=/sm/fc5fd902a482222922ed8730fd6d0d77a3740faf716db8fa553e36c6cda36422.map
|