1 line
54 KiB
Plaintext
1 line
54 KiB
Plaintext
|
|
{"version":3,"file":"OrbitControls.cjs","sources":["../../src/controls/OrbitControls.ts"],"sourcesContent":["import {\n Matrix4,\n MOUSE,\n OrthographicCamera,\n PerspectiveCamera,\n Quaternion,\n Spherical,\n TOUCH,\n Vector2,\n Vector3,\n Ray,\n Plane,\n} from 'three'\nimport { EventDispatcher } from './EventDispatcher'\nimport { StandardControlsEventMap } from './StandardControlsEventMap'\n\nconst _ray = /* @__PURE__ */ new Ray()\nconst _plane = /* @__PURE__ */ new Plane()\nconst TILT_LIMIT = Math.cos(70 * (Math.PI / 180))\n\n// This set of controls performs orbiting, dollying (zooming), and panning.\n// Unlike TrackballControls, it maintains the \"up\" direction object.up (+Y by default).\n//\n// Orbit - left mouse / touch: one-finger move\n// Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish\n// Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move\n\nconst moduloWrapAround = (offset: number, capacity: number) => ((offset % capacity) + capacity) % capacity\n\nclass OrbitControls extends EventDispatcher<StandardControlsEventMap> {\n object: PerspectiveCamera | OrthographicCamera\n domElement: HTMLElement | undefined\n // Set to false to disable this control\n enabled = true\n // \"target\" sets the location of focus, where the object orbits around\n target = new Vector3()\n // How far you can dolly in and out ( PerspectiveCamera only )\n minDistance = 0\n maxDistance = Infinity\n // How far you can zoom in and out ( OrthographicCamera only )\n minZoom = 0\n maxZoom = Infinity\n // How far you can orbit vertically, upper and lower limits.\n // Range is 0 to Math.PI radians.\n minPolarAngle = 0 // radians\n maxPolarAngle = Math.PI // radians\n // How far you can orbit horizontally, upper and lower limits.\n // If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI )\n minAzimuthAngle = -Infinity // radians\n maxAzimuthAngle = Infinity // radians\n // Set to true to enable damping (inertia)\n // If damping is enabled, you must call controls.update() in your animation loop\n enableDamping = false\n dampingFactor = 0.05\n // This option actually enables dollying in and out; left as \"zoom\" for backwards compatibility.\n // Set to false to disable zooming\n enableZoom = true\n zoomSpeed = 1.0\n // Set to false to disable rotating\n enableRotate = true\n rotateSpeed = 1.0\n // Set to false to disable panning\n enablePan = true\n panSpeed = 1.0\n screenSpacePanning = true // if false, pan orthogonal to world-space direction camera.up\n keyPanSpeed = 7.0 // pixels moved per arrow key push\n zoomToCursor = false\n // Set to true to automatically rotate around the target\n // If auto-rotate is enabled, you must call controls.update() in your animation loop\n autoRotate = false\n autoRotateSpeed = 2.0 // 30 seconds per orbit when fps is 60\n reverseOrbit = false // true if you want to reverse the orbit to mouse drag from left to right = orbits left\n reverseHorizontalOrbit = false // true if you want to reverse the horizontal orbit direction\n reverseVerticalOrbit = false // true if you want to reverse the vertical orbit direction\n // The four arrow keys\n keys = { LEFT: 'ArrowLeft', UP: 'ArrowUp', RIGHT: 'ArrowRight', BOTTOM: 'ArrowDown' }\n // Mouse buttons\n mouseButtons: Partial<{\n LEFT: MOUSE\n MIDDLE: MOUSE\n RIGHT: MOUSE\n }> = {\n LEFT: MOUSE.ROTATE,\n MIDDLE: MOUSE.DOLLY,\n RIGHT: MOUSE.PAN,\n }\n // Touch fingers\n touches: Partial<{\n ONE: TOUCH\n TWO: TOUCH\n }> = { ONE: TOUCH.ROTATE, TWO: TOUCH.DOLLY_PAN }\n target0: Vector3\n position0: Vector3\n zoom0: number\n // the target DOM element for key events\n _domElementKeyEvents: any = null\n\n getPolarAngle: () => number\n getAzimuthalAngle: () => number\n setPolarAngle: (x: number) => void\n setAzimuthalAngle: (x: number) => void\n getDistance: () => number\n // Not used in most scenarios, however they can be useful for specific use cases\n getZoomS
|