{"version":3,"file":"vendor.camera-controls.aa81cb17daab84f7.bundle.js","mappings":";wIAOA,MAKMA,EAASC,OAAOC,OAAO,CACzBC,KAAM,EACNC,OAAQ,EACRC,MAAO,EACPC,OAAQ,EACRC,MAAO,EACPC,KAAM,GACNC,aAAc,GACdC,YAAa,GACbC,aAAc,IACdC,YAAa,IACbC,WAAY,IACZC,kBAAmB,KACnBC,mBAAoB,KACpBC,mBAAoB,KACpBC,iBAAkB,KAClBC,kBAAmB,MACnBC,kBAAmB,QAEvB,SAASC,EAAoBC,GACzB,OAAOA,EAAOD,mBAClB,CACA,SAASE,EAAqBD,GAC1B,OAAOA,EAAOC,oBAClB,CAEA,MAAMC,EAAiB,EAAVC,KAAKC,GACZC,EAAUF,KAAKC,GAAK,EAEpBE,EAAU,KAChB,SAASC,EAAWC,EAAQC,EAAQH,GAChC,OAAOH,KAAKO,IAAIF,GAAUC,CAC9B,CACA,SAASE,EAAaC,EAAGC,EAAGJ,EAAQH,GAChC,OAAOC,EAAWK,EAAIC,EAAGJ,EAC7B,CACA,SAASK,EAAYC,EAAOC,GACxB,OAAOb,KAAKc,MAAMF,EAAQC,GAAQA,CACtC,CACA,SAASE,EAAoBH,GACzB,OAAII,SAASJ,GACFA,EACPA,EAAQ,GACAK,OAAOC,UACZD,OAAOC,SAClB,CACA,SAASC,EAAoBP,GACzB,OAAIZ,KAAKO,IAAIK,GAASK,OAAOC,UAClBN,EACJA,GAAQQ,IACnB,CAEA,SAASC,EAA4BC,EAAUC,GAC3CA,EAAIC,IAAI,EAAG,GACXF,EAASG,SAASC,IACdH,EAAII,GAAKD,EAAQE,QACjBL,EAAIM,GAAKH,EAAQI,OAAO,IAE5BP,EAAII,GAAKL,EAASS,OAClBR,EAAIM,GAAKP,EAASS,MACtB,CAEA,SAASC,EAAiCnC,EAAQoC,GAC9C,QAAInC,EAAqBD,KACrBqC,QAAQC,KAAK,GAAGF,6CACT,EAGf,CAQA,SAASG,EAAiBC,GAOtB,OANIA,EAAOC,O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iB,OAAQ0b,EAAU,IAEhD,CAEA1N,sBAAsB3C,GAAe,CACrCgD,2BAA6B","sources":["webpack://client-app/./node_modules/camera-controls/dist/camera-controls.module.js"],"sourcesContent":["/*!\n * camera-controls\n * https://github.com/yomotsu/camera-controls\n * (c) 2017 @yomotsu\n * Released under the MIT License.\n */\n// see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#value\nconst MOUSE_BUTTON = {\n LEFT: 1,\n RIGHT: 2,\n MIDDLE: 4,\n};\nconst ACTION = Object.freeze({\n NONE: 0,\n ROTATE: 1,\n TRUCK: 2,\n OFFSET: 4,\n DOLLY: 8,\n ZOOM: 16,\n TOUCH_ROTATE: 32,\n TOUCH_TRUCK: 64,\n TOUCH_OFFSET: 128,\n TOUCH_DOLLY: 256,\n TOUCH_ZOOM: 512,\n TOUCH_DOLLY_TRUCK: 1024,\n TOUCH_DOLLY_OFFSET: 2048,\n TOUCH_DOLLY_ROTATE: 4096,\n TOUCH_ZOOM_TRUCK: 8192,\n TOUCH_ZOOM_OFFSET: 16384,\n TOUCH_ZOOM_ROTATE: 32768,\n});\nfunction isPerspectiveCamera(camera) {\n return camera.isPerspectiveCamera;\n}\nfunction isOrthographicCamera(camera) {\n return camera.isOrthographicCamera;\n}\n\nconst PI_2 = Math.PI * 2;\nconst PI_HALF = Math.PI / 2;\n\nconst EPSILON = 1e-5;\nfunction approxZero(number, error = EPSILON) {\n return Math.abs(number) < error;\n}\nfunction approxEquals(a, b, error = EPSILON) {\n return approxZero(a - b, error);\n}\nfunction roundToStep(value, step) {\n return Math.round(value / step) * step;\n}\nfunction infinityToMaxNumber(value) {\n if (isFinite(value))\n return value;\n if (value < 0)\n return -Number.MAX_VALUE;\n return Number.MAX_VALUE;\n}\nfunction maxNumberToInfinity(value) {\n if (Math.abs(value) < Number.MAX_VALUE)\n return value;\n return value * Infinity;\n}\n\nfunction extractClientCoordFromEvent(pointers, out) {\n out.set(0, 0);\n pointers.forEach((pointer) => {\n out.x += pointer.clientX;\n out.y += pointer.clientY;\n });\n out.x /= pointers.length;\n out.y /= pointers.length;\n}\n\nfunction notSupportedInOrthographicCamera(camera, message) {\n if (isOrthographicCamera(camera)) {\n console.warn(`${message} is not supported in OrthographicCamera`);\n return true;\n }\n return false;\n}\n\n/**\n * A compat function for `Quaternion.invert()` / `Quaternion.inverse()`.\n * `Quaternion.invert()` is introduced in r123 and `Quaternion.inverse()` emits a warning.\n * We are going to use this compat for a while.\n * @param target A target quaternion\n */\nfunction quatInvertCompat(target) {\n if (target.invert) {\n target.invert();\n }\n else {\n target.inverse();\n }\n return target;\n}\n\nclass EventDispatcher {\n constructor() {\n this._listeners = {};\n }\n /**\n * Adds the specified event listener.\n * @param type event name\n * @param listener handler function\n * @category Methods\n */\n addEventListener(type, listener) {\n const listeners = this._listeners;\n if (listeners[type] === undefined)\n listeners[type] = [];\n if (listeners[type].indexOf(listener) === -1)\n listeners[type].push(listener);\n }\n /**\n * Presence of the specified event listener.\n * @param type event name\n * @param listener handler function\n * @category Methods\n */\n hasEventListener(type, listener) {\n const listeners = this._listeners;\n return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1;\n }\n /**\n * Removes the specified event listener\n * @param type event name\n * @param listener handler function\n * @category Methods\n */\n removeEventListener(type, listener) {\n const listeners = this._listeners;\n const listenerArray = listeners[type];\n if (listenerArray !== undefined) {\n const index = listenerArray.indexOf(listener);\n if (index !== -1)\n listenerArray.splice(index, 1);\n }\n }\n /**\n * Removes all event listeners\n * @param type event name\n * @category Methods\n */\n removeAllEventListeners(type) {\n if (!type) {\n this._listeners = {};\n return;\n }\n if (Array.isArray(this._listeners[type]))\n this._listeners[type].length = 0;\n }\n /**\n * Fire an event type.\n * @param event DispatcherEvent\n * @category Methods\n */\n dispatchEvent(event) {\n const listeners = this._listeners;\n const listenerArray = listeners[event.type];\n if (listenerArray !== undefined) {\n event.target = this;\n const array = listenerArray.slice(0);\n for (let i = 0, l = array.length; i < l; i++) {\n array[i].call(this, event);\n }\n }\n }\n}\n\nconst VERSION = '1.38.1'; // will be replaced with `version` in package.json during the build process.\nconst TOUCH_DOLLY_FACTOR = 1 / 8;\nconst isBrowser = typeof window !== 'undefined';\nconst isMac = isBrowser && /Mac/.test(navigator.platform);\nconst isPointerEventsNotSupported = !(isBrowser && 'PointerEvent' in window); // Safari 12 does not support PointerEvents API\nlet THREE;\nlet _ORIGIN;\nlet _AXIS_Y;\nlet _AXIS_Z;\nlet _v2;\nlet _v3A;\nlet _v3B;\nlet _v3C;\nlet _xColumn;\nlet _yColumn;\nlet _zColumn;\nlet _deltaTarget;\nlet _deltaOffset;\nlet _sphericalA;\nlet _sphericalB;\nlet _box3A;\nlet _box3B;\nlet _sphere;\nlet _quaternionA;\nlet _quaternionB;\nlet _rotationMatrix;\nlet _raycaster;\nclass CameraControls extends EventDispatcher {\n /**\n * Injects THREE as the dependency. You can then proceed to use CameraControls.\n *\n * e.g\n * ```javascript\n * CameraControls.install( { THREE: THREE } );\n * ```\n *\n * Note: If you do not wish to use enter three.js to reduce file size(tree-shaking for example), make a subset to install.\n *\n * ```js\n * import {\n * \tVector2,\n * \tVector3,\n * \tVector4,\n * \tQuaternion,\n * \tMatrix4,\n * \tSpherical,\n * \tBox3,\n * \tSphere,\n * \tRaycaster,\n * \tMathUtils,\n * } from 'three';\n *\n * const subsetOfTHREE = {\n * \tVector2 : Vector2,\n * \tVector3 : Vector3,\n * \tVector4 : Vector4,\n * \tQuaternion: Quaternion,\n * \tMatrix4 : Matrix4,\n * \tSpherical : Spherical,\n * \tBox3 : Box3,\n * \tSphere : Sphere,\n * \tRaycaster : Raycaster,\n * \tMathUtils : {\n * \t\tDEG2RAD: MathUtils.DEG2RAD,\n * \t\tclamp: MathUtils.clamp,\n * \t},\n * };\n\n * CameraControls.install( { THREE: subsetOfTHREE } );\n * ```\n * @category Statics\n */\n static install(libs) {\n THREE = libs.THREE;\n _ORIGIN = Object.freeze(new THREE.Vector3(0, 0, 0));\n _AXIS_Y = Object.freeze(new THREE.Vector3(0, 1, 0));\n _AXIS_Z = Object.freeze(new THREE.Vector3(0, 0, 1));\n _v2 = new THREE.Vector2();\n _v3A = new THREE.Vector3();\n _v3B = new THREE.Vector3();\n _v3C = new THREE.Vector3();\n _xColumn = new THREE.Vector3();\n _yColumn = new THREE.Vector3();\n _zColumn = new THREE.Vector3();\n _deltaTarget = new THREE.Vector3();\n _deltaOffset = new THREE.Vector3();\n _sphericalA = new THREE.Spherical();\n _sphericalB = new THREE.Spherical();\n _box3A = new THREE.Box3();\n _box3B = new THREE.Box3();\n _sphere = new THREE.Sphere();\n _quaternionA = new THREE.Quaternion();\n _quaternionB = new THREE.Quaternion();\n _rotationMatrix = new THREE.Matrix4();\n _raycaster = new THREE.Raycaster();\n }\n /**\n * list all ACTIONs\n * @category Statics\n */\n static get ACTION() {\n return ACTION;\n }\n /**\n * Creates a `CameraControls` instance.\n *\n * Note:\n * You **must install** three.js before using camera-controls. see [#install](#install)\n * Not doing so will lead to runtime errors (`undefined` references to THREE).\n *\n * e.g.\n * ```\n * CameraControls.install( { THREE } );\n * const cameraControls = new CameraControls( camera, domElement );\n * ```\n *\n * @param camera A `THREE.PerspectiveCamera` or `THREE.OrthographicCamera` to be controlled.\n * @param domElement A `HTMLElement` for the draggable area, usually `renderer.domElement`.\n * @category Constructor\n */\n constructor(camera, domElement) {\n super();\n /**\n * Minimum vertical angle in radians.\n * The angle has to be between `0` and `.maxPolarAngle` inclusive.\n * The default value is `0`.\n *\n * e.g.\n * ```\n * cameraControls.maxPolarAngle = 0;\n * ```\n * @category Properties\n */\n this.minPolarAngle = 0; // radians\n /**\n * Maximum vertical angle in radians.\n * The angle has to be between `.maxPolarAngle` and `Math.PI` inclusive.\n * The default value is `Math.PI`.\n *\n * e.g.\n * ```\n * cameraControls.maxPolarAngle = Math.PI;\n * ```\n * @category Properties\n */\n this.maxPolarAngle = Math.PI; // radians\n /**\n * Minimum horizontal angle in radians.\n * The angle has to be less than `.maxAzimuthAngle`.\n * The default value is `- Infinity`.\n *\n * e.g.\n * ```\n * cameraControls.minAzimuthAngle = - Infinity;\n * ```\n * @category Properties\n */\n this.minAzimuthAngle = -Infinity; // radians\n /**\n * Maximum horizontal angle in radians.\n * The angle has to be greater than `.minAzimuthAngle`.\n * The default value is `Infinity`.\n *\n * e.g.\n * ```\n * cameraControls.maxAzimuthAngle = Infinity;\n * ```\n * @category Properties\n */\n this.maxAzimuthAngle = Infinity; // radians\n // How far you can dolly in and out ( PerspectiveCamera only )\n /**\n * Minimum distance for dolly. The value must be higher than `0`.\n * PerspectiveCamera only.\n * @category Properties\n */\n this.minDistance = 0;\n /**\n * Maximum distance for dolly. The value must be higher than `minDistance`.\n * PerspectiveCamera only.\n * @category Properties\n */\n this.maxDistance = Infinity;\n /**\n * `true` to enable Infinity Dolly.\n * When the Dolly distance is less than the `minDistance`, radius of the sphere will be set `minDistance` automatically.\n * @category Properties\n */\n this.infinityDolly = false;\n /**\n * Minimum camera zoom.\n * @category Properties\n */\n this.minZoom = 0.01;\n /**\n * Maximum camera zoom.\n * @category Properties\n */\n this.maxZoom = Infinity;\n /**\n * The damping inertia.\n * The value must be between `Math.EPSILON` to `1` inclusive.\n * Setting `1` to disable smooth transitions.\n * @category Properties\n */\n this.dampingFactor = 0.05;\n /**\n * The damping inertia while dragging.\n * The value must be between `Math.EPSILON` to `1` inclusive.\n * Setting `1` to disable smooth transitions.\n * @category Properties\n */\n this.draggingDampingFactor = 0.25;\n /**\n * Speed of azimuth (horizontal) rotation.\n * @category Properties\n */\n this.azimuthRotateSpeed = 1.0;\n /**\n * Speed of polar (vertical) rotation.\n * @category Properties\n */\n this.polarRotateSpeed = 1.0;\n /**\n * Speed of mouse-wheel dollying.\n * @category Properties\n */\n this.dollySpeed = 1.0;\n /**\n * Speed of drag for truck and pedestal.\n * @category Properties\n */\n this.truckSpeed = 2.0;\n /**\n * `true` to enable Dolly-in to the mouse cursor coords.\n * @category Properties\n */\n this.dollyToCursor = false;\n /**\n * @category Properties\n */\n this.dragToOffset = false;\n /**\n * The same as `.screenSpacePanning` in three.js's OrbitControls.\n * @category Properties\n */\n this.verticalDragToForward = false;\n /**\n * Friction ratio of the boundary.\n * @category Properties\n */\n this.boundaryFriction = 0.0;\n /**\n * Controls how soon the `rest` event fires as the camera slows.\n * @category Properties\n */\n this.restThreshold = 0.01;\n /**\n * An array of Meshes to collide with camera.\n * Be aware colliderMeshes may decrease performance. The collision test uses 4 raycasters from the camera since the near plane has 4 corners.\n * @category Properties\n */\n this.colliderMeshes = [];\n /**\n * Force cancel user dragging.\n * @category Methods\n */\n // cancel will be overwritten in the constructor.\n this.cancel = () => { };\n this._enabled = true;\n this._state = ACTION.NONE;\n this._viewport = null;\n this._affectOffset = false;\n this._dollyControlAmount = 0;\n this._hasRested = true;\n this._boundaryEnclosesCamera = false;\n this._needsUpdate = true;\n this._updatedLastTime = false;\n this._elementRect = new DOMRect();\n this._activePointers = [];\n this._truckInternal = (deltaX, deltaY, dragToOffset) => {\n if (isPerspectiveCamera(this._camera)) {\n const offset = _v3A.copy(this._camera.position).sub(this._target);\n // half of the fov is center to top of screen\n const fov = this._camera.getEffectiveFOV() * THREE.MathUtils.DEG2RAD;\n const targetDistance = offset.length() * Math.tan(fov * 0.5);\n const truckX = (this.truckSpeed * deltaX * targetDistance / this._elementRect.height);\n const pedestalY = (this.truckSpeed * deltaY * targetDistance / this._elementRect.height);\n if (this.verticalDragToForward) {\n dragToOffset ?\n this.setFocalOffset(this._focalOffsetEnd.x + truckX, this._focalOffsetEnd.y, this._focalOffsetEnd.z, true) :\n this.truck(truckX, 0, true);\n this.forward(-pedestalY, true);\n }\n else {\n dragToOffset ?\n this.setFocalOffset(this._focalOffsetEnd.x + truckX, this._focalOffsetEnd.y + pedestalY, this._focalOffsetEnd.z, true) :\n this.truck(truckX, pedestalY, true);\n }\n }\n else if (isOrthographicCamera(this._camera)) {\n // orthographic\n const camera = this._camera;\n const truckX = deltaX * (camera.right - camera.left) / camera.zoom / this._elementRect.width;\n const pedestalY = deltaY * (camera.top - camera.bottom) / camera.zoom / this._elementRect.height;\n dragToOffset ?\n this.setFocalOffset(this._focalOffsetEnd.x + truckX, this._focalOffsetEnd.y + pedestalY, this._focalOffsetEnd.z, true) :\n this.truck(truckX, pedestalY, true);\n }\n };\n this._rotateInternal = (deltaX, deltaY) => {\n const theta = PI_2 * this.azimuthRotateSpeed * deltaX / this._elementRect.height; // divide by *height* to refer the resolution\n const phi = PI_2 * this.polarRotateSpeed * deltaY / this._elementRect.height;\n this.rotate(theta, phi, true);\n };\n this._dollyInternal = (delta, x, y) => {\n const dollyScale = Math.pow(0.95, -delta * this.dollySpeed);\n const distance = this._sphericalEnd.radius * dollyScale;\n const prevRadius = this._sphericalEnd.radius;\n const signedPrevRadius = prevRadius * (delta >= 0 ? -1 : 1);\n this.dollyTo(distance);\n if (this.infinityDolly && (distance < this.minDistance || this.maxDistance === this.minDistance)) {\n this._camera.getWorldDirection(_v3A);\n this._targetEnd.add(_v3A.normalize().multiplyScalar(signedPrevRadius));\n this._target.add(_v3A.normalize().multiplyScalar(signedPrevRadius));\n }\n if (this.dollyToCursor) {\n this._dollyControlAmount += this._sphericalEnd.radius - prevRadius;\n if (this.infinityDolly && (distance < this.minDistance || this.maxDistance === this.minDistance)) {\n this._dollyControlAmount -= signedPrevRadius;\n }\n this._dollyControlCoord.set(x, y);\n }\n return;\n };\n this._zoomInternal = (delta, x, y) => {\n const zoomScale = Math.pow(0.95, delta * this.dollySpeed);\n const prevZoom = this._zoomEnd;\n // for both PerspectiveCamera and OrthographicCamera\n this.zoomTo(this._zoom * zoomScale);\n if (this.dollyToCursor) {\n this._dollyControlAmount += this._zoomEnd - prevZoom;\n this._dollyControlCoord.set(x, y);\n }\n return;\n };\n // Check if the user has installed THREE\n if (typeof THREE === 'undefined') {\n console.error('camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information.');\n }\n this._camera = camera;\n this._yAxisUpSpace = new THREE.Quaternion().setFromUnitVectors(this._camera.up, _AXIS_Y);\n this._yAxisUpSpaceInverse = quatInvertCompat(this._yAxisUpSpace.clone());\n this._state = ACTION.NONE;\n // the location\n this._target = new THREE.Vector3();\n this._targetEnd = this._target.clone();\n this._focalOffset = new THREE.Vector3();\n this._focalOffsetEnd = this._focalOffset.clone();\n // rotation\n this._spherical = new THREE.Spherical().setFromVector3(_v3A.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace));\n this._sphericalEnd = this._spherical.clone();\n this._zoom = this._camera.zoom;\n this._zoomEnd = this._zoom;\n // collisionTest uses nearPlane.s\n this._nearPlaneCorners = [\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n ];\n this._updateNearPlaneCorners();\n // Target cannot move outside of this box\n this._boundary = new THREE.Box3(new THREE.Vector3(-Infinity, -Infinity, -Infinity), new THREE.Vector3(Infinity, Infinity, Infinity));\n // reset\n this._target0 = this._target.clone();\n this._position0 = this._camera.position.clone();\n this._zoom0 = this._zoom;\n this._focalOffset0 = this._focalOffset.clone();\n this._dollyControlAmount = 0;\n this._dollyControlCoord = new THREE.Vector2();\n // configs\n this.mouseButtons = {\n left: ACTION.ROTATE,\n middle: ACTION.DOLLY,\n right: ACTION.TRUCK,\n wheel: isPerspectiveCamera(this._camera) ? ACTION.DOLLY :\n isOrthographicCamera(this._camera) ? ACTION.ZOOM :\n ACTION.NONE,\n };\n this.touches = {\n one: ACTION.TOUCH_ROTATE,\n two: isPerspectiveCamera(this._camera) ? ACTION.TOUCH_DOLLY_TRUCK :\n isOrthographicCamera(this._camera) ? ACTION.TOUCH_ZOOM_TRUCK :\n ACTION.NONE,\n three: ACTION.TOUCH_TRUCK,\n };\n const dragStartPosition = new THREE.Vector2();\n const lastDragPosition = new THREE.Vector2();\n const dollyStart = new THREE.Vector2();\n const onPointerDown = (event) => {\n if (!this._enabled || !this._domElement)\n return;\n // Don't call `event.preventDefault()` on the pointerdown event\n // to keep receiving pointermove evens outside dragging iframe\n // https://taye.me/blog/tips/2015/11/16/mouse-drag-outside-iframe/\n const pointer = {\n pointerId: event.pointerId,\n clientX: event.clientX,\n clientY: event.clientY,\n deltaX: 0,\n deltaY: 0,\n };\n this._activePointers.push(pointer);\n // eslint-disable-next-line no-undef\n this._domElement.ownerDocument.removeEventListener('pointermove', onPointerMove, { passive: false });\n this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);\n this._domElement.ownerDocument.addEventListener('pointermove', onPointerMove, { passive: false });\n this._domElement.ownerDocument.addEventListener('pointerup', onPointerUp);\n startDragging(event);\n };\n const onMouseDown = (event) => {\n if (!this._enabled || !this._domElement)\n return;\n const pointer = {\n pointerId: 0,\n clientX: event.clientX,\n clientY: event.clientY,\n deltaX: 0,\n deltaY: 0,\n };\n this._activePointers.push(pointer);\n // see https://github.com/microsoft/TypeScript/issues/32912#issuecomment-522142969\n // eslint-disable-next-line no-undef\n this._domElement.ownerDocument.removeEventListener('mousemove', onMouseMove);\n this._domElement.ownerDocument.removeEventListener('mouseup', onMouseUp);\n this._domElement.ownerDocument.addEventListener('mousemove', onMouseMove);\n this._domElement.ownerDocument.addEventListener('mouseup', onMouseUp);\n startDragging(event);\n };\n const onTouchStart = (event) => {\n if (!this._enabled || !this._domElement)\n return;\n event.preventDefault();\n Array.prototype.forEach.call(event.changedTouches, (touch) => {\n const pointer = {\n pointerId: touch.identifier,\n clientX: touch.clientX,\n clientY: touch.clientY,\n deltaX: 0,\n deltaY: 0,\n };\n this._activePointers.push(pointer);\n });\n // eslint-disable-next-line no-undef\n this._domElement.ownerDocument.removeEventListener('touchmove', onTouchMove, { passive: false });\n this._domElement.ownerDocument.removeEventListener('touchend', onTouchEnd);\n this._domElement.ownerDocument.addEventListener('touchmove', onTouchMove, { passive: false });\n this._domElement.ownerDocument.addEventListener('touchend', onTouchEnd);\n startDragging(event);\n };\n const onPointerMove = (event) => {\n if (event.cancelable)\n event.preventDefault();\n const pointerId = event.pointerId;\n const pointer = this._findPointerById(pointerId);\n if (!pointer)\n return;\n pointer.clientX = event.clientX;\n pointer.clientY = event.clientY;\n pointer.deltaX = event.movementX;\n pointer.deltaY = event.movementY;\n if (event.pointerType === 'touch') {\n switch (this._activePointers.length) {\n case 1:\n this._state = this.touches.one;\n break;\n case 2:\n this._state = this.touches.two;\n break;\n case 3:\n this._state = this.touches.three;\n break;\n }\n }\n else {\n this._state = 0;\n if ((event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT) {\n this._state = this._state | this.mouseButtons.left;\n }\n if ((event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE) {\n this._state = this._state | this.mouseButtons.middle;\n }\n if ((event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT) {\n this._state = this._state | this.mouseButtons.right;\n }\n }\n dragging();\n };\n const onMouseMove = (event) => {\n const pointer = this._findPointerById(0);\n if (!pointer)\n return;\n pointer.clientX = event.clientX;\n pointer.clientY = event.clientY;\n pointer.deltaX = event.movementX;\n pointer.deltaY = event.movementY;\n this._state = 0;\n if ((event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT) {\n this._state = this._state | this.mouseButtons.left;\n }\n if ((event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE) {\n this._state = this._state | this.mouseButtons.middle;\n }\n if ((event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT) {\n this._state = this._state | this.mouseButtons.right;\n }\n dragging();\n };\n const onTouchMove = (event) => {\n if (event.cancelable)\n event.preventDefault();\n Array.prototype.forEach.call(event.changedTouches, (touch) => {\n const pointerId = touch.identifier;\n const pointer = this._findPointerById(pointerId);\n if (!pointer)\n return;\n pointer.clientX = touch.clientX;\n pointer.clientY = touch.clientY;\n // touch event does not have movementX and movementY.\n });\n dragging();\n };\n const onPointerUp = (event) => {\n const pointerId = event.pointerId;\n const pointer = this._findPointerById(pointerId);\n pointer && this._activePointers.splice(this._activePointers.indexOf(pointer), 1);\n if (event.pointerType === 'touch') {\n switch (this._activePointers.length) {\n case 0:\n this._state = ACTION.NONE;\n break;\n case 1:\n this._state = this.touches.one;\n break;\n case 2:\n this._state = this.touches.two;\n break;\n case 3:\n this._state = this.touches.three;\n break;\n }\n }\n else {\n this._state = ACTION.NONE;\n }\n endDragging();\n };\n const onMouseUp = () => {\n const pointer = this._findPointerById(0);\n pointer && this._activePointers.splice(this._activePointers.indexOf(pointer), 1);\n this._state = ACTION.NONE;\n endDragging();\n };\n const onTouchEnd = (event) => {\n Array.prototype.forEach.call(event.changedTouches, (touch) => {\n const pointerId = touch.identifier;\n const pointer = this._findPointerById(pointerId);\n pointer && this._activePointers.splice(this._activePointers.indexOf(pointer), 1);\n });\n switch (this._activePointers.length) {\n case 0:\n this._state = ACTION.NONE;\n break;\n case 1:\n this._state = this.touches.one;\n break;\n case 2:\n this._state = this.touches.two;\n break;\n case 3:\n this._state = this.touches.three;\n break;\n }\n endDragging();\n };\n let lastScrollTimeStamp = -1;\n const onMouseWheel = (event) => {\n if (!this._enabled || this.mouseButtons.wheel === ACTION.NONE)\n return;\n event.preventDefault();\n if (this.dollyToCursor ||\n this.mouseButtons.wheel === ACTION.ROTATE ||\n this.mouseButtons.wheel === ACTION.TRUCK) {\n const now = performance.now();\n // only need to fire this at scroll start.\n if (lastScrollTimeStamp - now < 1000)\n this._getClientRect(this._elementRect);\n lastScrollTimeStamp = now;\n }\n // Ref: https://github.com/cedricpinson/osgjs/blob/00e5a7e9d9206c06fdde0436e1d62ab7cb5ce853/sources/osgViewer/input/source/InputSourceMouse.js#L89-L103\n const deltaYFactor = isMac ? -1 : -3;\n const delta = (event.deltaMode === 1) ? event.deltaY / deltaYFactor : event.deltaY / (deltaYFactor * 10);\n const x = this.dollyToCursor ? (event.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0;\n const y = this.dollyToCursor ? (event.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;\n switch (this.mouseButtons.wheel) {\n case ACTION.ROTATE: {\n this._rotateInternal(event.deltaX, event.deltaY);\n break;\n }\n case ACTION.TRUCK: {\n this._truckInternal(event.deltaX, event.deltaY, false);\n break;\n }\n case ACTION.OFFSET: {\n this._truckInternal(event.deltaX, event.deltaY, true);\n break;\n }\n case ACTION.DOLLY: {\n this._dollyInternal(-delta, x, y);\n break;\n }\n case ACTION.ZOOM: {\n this._zoomInternal(-delta, x, y);\n break;\n }\n }\n this.dispatchEvent({ type: 'control' });\n };\n const onContextMenu = (event) => {\n if (!this._enabled)\n return;\n event.preventDefault();\n };\n const startDragging = (event) => {\n if (!this._enabled)\n return;\n extractClientCoordFromEvent(this._activePointers, _v2);\n this._getClientRect(this._elementRect);\n dragStartPosition.copy(_v2);\n lastDragPosition.copy(_v2);\n const isMultiTouch = this._activePointers.length >= 2;\n if (isMultiTouch) {\n // 2 finger pinch\n const dx = _v2.x - this._activePointers[1].clientX;\n const dy = _v2.y - this._activePointers[1].clientY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n dollyStart.set(0, distance);\n // center coords of 2 finger truck\n const x = (this._activePointers[0].clientX + this._activePointers[1].clientX) * 0.5;\n const y = (this._activePointers[0].clientY + this._activePointers[1].clientY) * 0.5;\n lastDragPosition.set(x, y);\n }\n if ('touches' in event ||\n 'pointerType' in event && event.pointerType === 'touch') {\n switch (this._activePointers.length) {\n case 1:\n this._state = this.touches.one;\n break;\n case 2:\n this._state = this.touches.two;\n break;\n case 3:\n this._state = this.touches.three;\n break;\n }\n }\n else {\n this._state = 0;\n if ((event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT) {\n this._state = this._state | this.mouseButtons.left;\n }\n if ((event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE) {\n this._state = this._state | this.mouseButtons.middle;\n }\n if ((event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT) {\n this._state = this._state | this.mouseButtons.right;\n }\n }\n this.dispatchEvent({ type: 'controlstart' });\n };\n const dragging = () => {\n if (!this._enabled)\n return;\n extractClientCoordFromEvent(this._activePointers, _v2);\n // When pointer lock is enabled clientX, clientY, screenX, and screenY remain 0.\n // If pointer lock is enabled, use the Delta directory, and assume active-pointer is not multiple.\n const isPointerLockActive = this._domElement && document.pointerLockElement === this._domElement;\n const deltaX = isPointerLockActive ? -this._activePointers[0].deltaX : lastDragPosition.x - _v2.x;\n const deltaY = isPointerLockActive ? -this._activePointers[0].deltaY : lastDragPosition.y - _v2.y;\n lastDragPosition.copy(_v2);\n if ((this._state & ACTION.ROTATE) === ACTION.ROTATE ||\n (this._state & ACTION.TOUCH_ROTATE) === ACTION.TOUCH_ROTATE ||\n (this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE ||\n (this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {\n this._rotateInternal(deltaX, deltaY);\n }\n if ((this._state & ACTION.DOLLY) === ACTION.DOLLY ||\n (this._state & ACTION.ZOOM) === ACTION.ZOOM) {\n const dollyX = this.dollyToCursor ? (dragStartPosition.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0;\n const dollyY = this.dollyToCursor ? (dragStartPosition.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;\n (this._state & ACTION.DOLLY) === ACTION.DOLLY ?\n this._dollyInternal(deltaY * TOUCH_DOLLY_FACTOR, dollyX, dollyY) :\n this._zoomInternal(deltaY * TOUCH_DOLLY_FACTOR, dollyX, dollyY);\n }\n if ((this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY ||\n (this._state & ACTION.TOUCH_ZOOM) === ACTION.TOUCH_ZOOM ||\n (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK ||\n (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK ||\n (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET ||\n (this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET ||\n (this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE ||\n (this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {\n const dx = _v2.x - this._activePointers[1].clientX;\n const dy = _v2.y - this._activePointers[1].clientY;\n const distance = Math.sqrt(dx * dx + dy * dy);\n const dollyDelta = dollyStart.y - distance;\n dollyStart.set(0, distance);\n const dollyX = this.dollyToCursor ? (lastDragPosition.x - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0;\n const dollyY = this.dollyToCursor ? (lastDragPosition.y - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;\n (this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY ||\n (this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE ||\n (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK ||\n (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET ?\n this._dollyInternal(dollyDelta * TOUCH_DOLLY_FACTOR, dollyX, dollyY) :\n this._zoomInternal(dollyDelta * TOUCH_DOLLY_FACTOR, dollyX, dollyY);\n }\n if ((this._state & ACTION.TRUCK) === ACTION.TRUCK ||\n (this._state & ACTION.TOUCH_TRUCK) === ACTION.TOUCH_TRUCK ||\n (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK ||\n (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK) {\n this._truckInternal(deltaX, deltaY, false);\n }\n if ((this._state & ACTION.OFFSET) === ACTION.OFFSET ||\n (this._state & ACTION.TOUCH_OFFSET) === ACTION.TOUCH_OFFSET ||\n (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET ||\n (this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET) {\n this._truckInternal(deltaX, deltaY, true);\n }\n this.dispatchEvent({ type: 'control' });\n };\n const endDragging = () => {\n extractClientCoordFromEvent(this._activePointers, _v2);\n lastDragPosition.copy(_v2);\n if (this._activePointers.length === 0 && this._domElement) {\n // eslint-disable-next-line no-undef\n this._domElement.ownerDocument.removeEventListener('pointermove', onPointerMove, { passive: false });\n this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);\n // eslint-disable-next-line no-undef\n this._domElement.ownerDocument.removeEventListener('touchmove', onTouchMove, { passive: false });\n this._domElement.ownerDocument.removeEventListener('touchend', onTouchEnd);\n this.dispatchEvent({ type: 'controlend' });\n }\n };\n this._addAllEventListeners = (domElement) => {\n this._domElement = domElement;\n this._domElement.style.touchAction = 'none';\n this._domElement.style.userSelect = 'none';\n this._domElement.style.webkitUserSelect = 'none';\n this._domElement.addEventListener('pointerdown', onPointerDown);\n isPointerEventsNotSupported && this._domElement.addEventListener('mousedown', onMouseDown);\n isPointerEventsNotSupported && this._domElement.addEventListener('touchstart', onTouchStart);\n this._domElement.addEventListener('pointercancel', onPointerUp);\n this._domElement.addEventListener('wheel', onMouseWheel, { passive: false });\n this._domElement.addEventListener('contextmenu', onContextMenu);\n };\n this._removeAllEventListeners = () => {\n if (!this._domElement)\n return;\n this._domElement.removeEventListener('pointerdown', onPointerDown);\n this._domElement.removeEventListener('mousedown', onMouseDown);\n this._domElement.removeEventListener('touchstart', onTouchStart);\n this._domElement.removeEventListener('pointercancel', onPointerUp);\n // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener#matching_event_listeners_for_removal\n // > it's probably wise to use the same values used for the call to `addEventListener()` when calling `removeEventListener()`\n // see https://github.com/microsoft/TypeScript/issues/32912#issuecomment-522142969\n // eslint-disable-next-line no-undef\n this._domElement.removeEventListener('wheel', onMouseWheel, { passive: false });\n this._domElement.removeEventListener('contextmenu', onContextMenu);\n // eslint-disable-next-line no-undef\n this._domElement.ownerDocument.removeEventListener('pointermove', onPointerMove, { passive: false });\n this._domElement.ownerDocument.removeEventListener('mousemove', onMouseMove);\n // eslint-disable-next-line no-undef\n this._domElement.ownerDocument.removeEventListener('touchmove', onTouchMove, { passive: false });\n this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);\n this._domElement.ownerDocument.removeEventListener('mouseup', onMouseUp);\n this._domElement.ownerDocument.removeEventListener('touchend', onTouchEnd);\n };\n this.cancel = () => {\n if (this._state === ACTION.NONE)\n return;\n this._state = ACTION.NONE;\n this._activePointers.length = 0;\n endDragging();\n };\n if (domElement)\n this.connect(domElement);\n this.update(0);\n }\n /**\n * The camera to be controlled\n * @category Properties\n */\n get camera() {\n return this._camera;\n }\n set camera(camera) {\n this._camera = camera;\n this.updateCameraUp();\n this._camera.updateProjectionMatrix();\n this._updateNearPlaneCorners();\n this._needsUpdate = true;\n }\n /**\n * Whether or not the controls are enabled.\n * `false` to disable user dragging/touch-move, but all methods works.\n * @category Properties\n */\n get enabled() {\n return this._enabled;\n }\n set enabled(enabled) {\n if (!this._domElement)\n return;\n this._enabled = enabled;\n if (enabled) {\n this._domElement.style.touchAction = 'none';\n this._domElement.style.userSelect = 'none';\n this._domElement.style.webkitUserSelect = 'none';\n }\n else {\n this.cancel();\n this._domElement.style.touchAction = '';\n this._domElement.style.userSelect = '';\n this._domElement.style.webkitUserSelect = '';\n }\n }\n /**\n * Returns `true` if the controls are active updating.\n * readonly value.\n * @category Properties\n */\n get active() {\n return !this._hasRested;\n }\n /**\n * Getter for the current `ACTION`.\n * readonly value.\n * @category Properties\n */\n get currentAction() {\n return this._state;\n }\n /**\n * get/set Current distance.\n * @category Properties\n */\n get distance() {\n return this._spherical.radius;\n }\n set distance(distance) {\n if (this._spherical.radius === distance &&\n this._sphericalEnd.radius === distance)\n return;\n this._spherical.radius = distance;\n this._sphericalEnd.radius = distance;\n this._needsUpdate = true;\n }\n // horizontal angle\n /**\n * get/set the azimuth angle (horizontal) in radians.\n * Every 360 degrees turn is added to `.azimuthAngle` value, which is accumulative.\n * @category Properties\n */\n get azimuthAngle() {\n return this._spherical.theta;\n }\n set azimuthAngle(azimuthAngle) {\n if (this._spherical.theta === azimuthAngle &&\n this._sphericalEnd.theta === azimuthAngle)\n return;\n this._spherical.theta = azimuthAngle;\n this._sphericalEnd.theta = azimuthAngle;\n this._needsUpdate = true;\n }\n // vertical angle\n /**\n * get/set the polar angle (vertical) in radians.\n * @category Properties\n */\n get polarAngle() {\n return this._spherical.phi;\n }\n set polarAngle(polarAngle) {\n if (this._spherical.phi === polarAngle &&\n this._sphericalEnd.phi === polarAngle)\n return;\n this._spherical.phi = polarAngle;\n this._sphericalEnd.phi = polarAngle;\n this._needsUpdate = true;\n }\n /**\n * Whether camera position should be enclosed in the boundary or not.\n * @category Properties\n */\n get boundaryEnclosesCamera() {\n return this._boundaryEnclosesCamera;\n }\n set boundaryEnclosesCamera(boundaryEnclosesCamera) {\n this._boundaryEnclosesCamera = boundaryEnclosesCamera;\n this._needsUpdate = true;\n }\n /**\n * Adds the specified event listener.\n * Applicable event types (which is `K`) are:\n * | Event name | Timing |\n * | ------------------- | ------ |\n * | `'controlstart'` | When the user starts to control the camera via mouse / touches. ¹ |\n * | `'control'` | When the user controls the camera (dragging). |\n * | `'controlend'` | When the user ends to control the camera. ¹ |\n * | `'transitionstart'` | When any kind of transition starts, either user control or using a method with `enableTransition = true` |\n * | `'update'` | When the camera position is updated. |\n * | `'wake'` | When the camera starts moving. |\n * | `'rest'` | When the camera movement is below `.restThreshold` ². |\n * | `'sleep'` | When the camera end moving. |\n *\n * 1. `mouseButtons.wheel` (Mouse wheel control) does not emit `'controlstart'` and `'controlend'`. `mouseButtons.wheel` uses scroll-event internally, and scroll-event happens intermittently. That means \"start\" and \"end\" cannot be detected.\n * 2. Due to damping, `sleep` will usually fire a few seconds after the camera _appears_ to have stopped moving. If you want to do something (e.g. enable UI, perform another transition) at the point when the camera has stopped, you probably want the `rest` event. This can be fine tuned using the `.restThreshold` parameter. See the [Rest and Sleep Example](https://yomotsu.github.io/camera-controls/examples/rest-and-sleep.html).\n *\n * e.g.\n * ```\n * cameraControl.addEventListener( 'controlstart', myCallbackFunction );\n * ```\n * @param type event name\n * @param listener handler function\n * @category Methods\n */\n addEventListener(type, listener) {\n super.addEventListener(type, listener);\n }\n /**\n * Removes the specified event listener\n * e.g.\n * ```\n * cameraControl.addEventListener( 'controlstart', myCallbackFunction );\n * ```\n * @param type event name\n * @param listener handler function\n * @category Methods\n */\n removeEventListener(type, listener) {\n super.removeEventListener(type, listener);\n }\n /**\n * Rotate azimuthal angle(horizontal) and polar angle(vertical).\n * Every value is added to the current value.\n * @param azimuthAngle Azimuth rotate angle. In radian.\n * @param polarAngle Polar rotate angle. In radian.\n * @param enableTransition Whether to move smoothly or immediately\n * @category Methods\n */\n rotate(azimuthAngle, polarAngle, enableTransition = false) {\n return this.rotateTo(this._sphericalEnd.theta + azimuthAngle, this._sphericalEnd.phi + polarAngle, enableTransition);\n }\n /**\n * Rotate azimuthal angle(horizontal) to the given angle and keep the same polar angle(vertical) target.\n *\n * e.g.\n * ```\n * cameraControls.rotateAzimuthTo( 30 * THREE.MathUtils.DEG2RAD, true );\n * ```\n * @param azimuthAngle Azimuth rotate angle. In radian.\n * @param enableTransition Whether to move smoothly or immediately\n * @category Methods\n */\n rotateAzimuthTo(azimuthAngle, enableTransition = false) {\n return this.rotateTo(azimuthAngle, this._sphericalEnd.phi, enableTransition);\n }\n /**\n * Rotate polar angle(vertical) to the given angle and keep the same azimuthal angle(horizontal) target.\n *\n * e.g.\n * ```\n * cameraControls.rotatePolarTo( 30 * THREE.MathUtils.DEG2RAD, true );\n * ```\n * @param polarAngle Polar rotate angle. In radian.\n * @param enableTransition Whether to move smoothly or immediately\n * @category Methods\n */\n rotatePolarTo(polarAngle, enableTransition = false) {\n return this.rotateTo(this._sphericalEnd.theta, polarAngle, enableTransition);\n }\n /**\n * Rotate azimuthal angle(horizontal) and polar angle(vertical) to the given angle.\n * Camera view will rotate over the orbit pivot absolutely:\n *\n * azimuthAngle\n * ```\n * 0º\n * \\\n * 90º -----+----- -90º\n * \\\n * 180º\n * ```\n * | direction | angle |\n * | --------- | ---------------------- |\n * | front | 0º |\n * | left | 90º (`Math.PI / 2`) |\n * | right | -90º (`- Math.PI / 2`) |\n * | back | 180º (`Math.PI`) |\n *\n * polarAngle\n * ```\n * 180º\n * |\n * 90º\n * |\n * 0º\n * ```\n * | direction | angle |\n * | -------------------- | ---------------------- |\n * | top/sky | 180º (`Math.PI`) |\n * | horizontal from view | 90º (`Math.PI / 2`) |\n * | bottom/floor | 0º |\n *\n * @param azimuthAngle Azimuth rotate angle to. In radian.\n * @param polarAngle Polar rotate angle to. In radian.\n * @param enableTransition Whether to move smoothly or immediately\n * @category Methods\n */\n rotateTo(azimuthAngle, polarAngle, enableTransition = false) {\n const theta = THREE.MathUtils.clamp(azimuthAngle, this.minAzimuthAngle, this.maxAzimuthAngle);\n const phi = THREE.MathUtils.clamp(polarAngle, this.minPolarAngle, this.maxPolarAngle);\n this._sphericalEnd.theta = theta;\n this._sphericalEnd.phi = phi;\n this._sphericalEnd.makeSafe();\n this._needsUpdate = true;\n if (!enableTransition) {\n this._spherical.theta = this._sphericalEnd.theta;\n this._spherical.phi = this._sphericalEnd.phi;\n }\n const resolveImmediately = !enableTransition ||\n approxEquals(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) &&\n approxEquals(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold);\n return this._createOnRestPromise(resolveImmediately);\n }\n /**\n * Dolly in/out camera position.\n * @param distance Distance of dollyIn. Negative number for dollyOut.\n * @param enableTransition Whether to move smoothly or immediately.\n * @category Methods\n */\n dolly(distance, enableTransition = false) {\n return this.dollyTo(this._sphericalEnd.radius - distance, enableTransition);\n }\n /**\n * Dolly in/out camera position to given distance.\n * @param distance Distance of dolly.\n * @param enableTransition Whether to move smoothly or immediately.\n * @category Methods\n */\n dollyTo(distance, enableTransition = false) {\n const lastRadius = this._sphericalEnd.radius;\n const newRadius = THREE.MathUtils.clamp(distance, this.minDistance, this.maxDistance);\n const hasCollider = this.colliderMeshes.length >= 1;\n if (hasCollider) {\n const maxDistanceByCollisionTest = this._collisionTest();\n const isCollided = approxEquals(maxDistanceByCollisionTest, this._spherical.radius);\n const isDollyIn = lastRadius > newRadius;\n if (!isDollyIn && isCollided)\n return Promise.resolve();\n this._sphericalEnd.radius = Math.min(newRadius, maxDistanceByCollisionTest);\n }\n else {\n this._sphericalEnd.radius = newRadius;\n }\n this._needsUpdate = true;\n if (!enableTransition) {\n this._spherical.radius = this._sphericalEnd.radius;\n }\n const resolveImmediately = !enableTransition || approxEquals(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);\n return this._createOnRestPromise(resolveImmediately);\n }\n /**\n * Zoom in/out camera. The value is added to camera zoom.\n * Limits set with `.minZoom` and `.maxZoom`\n * @param zoomStep zoom scale\n * @param enableTransition Whether to move smoothly or immediately\n * @category Methods\n */\n zoom(zoomStep, enableTransition = false) {\n return this.zoomTo(this._zoomEnd + zoomStep, enableTransition);\n }\n /**\n * Zoom in/out camera to given scale. The value overwrites camera zoom.\n * Limits set with .minZoom and .maxZoom\n * @param zoom\n * @param enableTransition\n * @category Methods\n */\n zoomTo(zoom, enableTransition = false) {\n this._zoomEnd = THREE.MathUtils.clamp(zoom, this.minZoom, this.maxZoom);\n this._needsUpdate = true;\n if (!enableTransition) {\n this._zoom = this._zoomEnd;\n }\n const resolveImmediately = !enableTransition || approxEquals(this._zoom, this._zoomEnd, this.restThreshold);\n return this._createOnRestPromise(resolveImmediately);\n }\n /**\n * @deprecated `pan()` has been renamed to `truck()`\n * @category Methods\n */\n pan(x, y, enableTransition = false) {\n console.warn('`pan` has been renamed to `truck`');\n return this.truck(x, y, enableTransition);\n }\n /**\n * Truck and pedestal camera using current azimuthal angle\n * @param x Horizontal translate amount\n * @param y Vertical translate amount\n * @param enableTransition Whether to move smoothly or immediately\n * @category Methods\n */\n truck(x, y, enableTransition = false) {\n this._camera.updateMatrix();\n _xColumn.setFromMatrixColumn(this._camera.matrix, 0);\n _yColumn.setFromMatrixColumn(this._camera.matrix, 1);\n _xColumn.multiplyScalar(x);\n _yColumn.multiplyScalar(-y);\n const offset = _v3A.copy(_xColumn).add(_yColumn);\n const to = _v3B.copy(this._targetEnd).add(offset);\n return this.moveTo(to.x, to.y, to.z, enableTransition);\n }\n /**\n * Move forward / backward.\n * @param distance Amount to move forward / backward. Negative value to move backward\n * @param enableTransition Whether to move smoothly or immediately\n * @category Methods\n */\n forward(distance, enableTransition = false) {\n _v3A.setFromMatrixColumn(this._camera.matrix, 0);\n _v3A.crossVectors(this._camera.up, _v3A);\n _v3A.multiplyScalar(distance);\n const to = _v3B.copy(this._targetEnd).add(_v3A);\n return this.moveTo(to.x, to.y, to.z, enableTransition);\n }\n /**\n * Move target position to given point.\n * @param x x coord to move center position\n * @param y y coord to move center position\n * @param z z coord to move center position\n * @param enableTransition Whether to move smoothly or immediately\n * @category Methods\n */\n moveTo(x, y, z, enableTransition = false) {\n const offset = _v3A.set(x, y, z).sub(this._targetEnd);\n this._encloseToBoundary(this._targetEnd, offset, this.boundaryFriction);\n this._needsUpdate = true;\n if (!enableTransition) {\n this._target.copy(this._targetEnd);\n }\n const resolveImmediately = !enableTransition ||\n approxEquals(this._target.x, this._targetEnd.x, this.restThreshold) &&\n approxEquals(this._target.y, this._targetEnd.y, this.restThreshold) &&\n approxEquals(this._target.z, this._targetEnd.z, this.restThreshold);\n return this._createOnRestPromise(resolveImmediately);\n }\n /**\n * Fit the viewport to the box or the bounding box of the object, using the nearest axis. paddings are in unit.\n * set `cover: true` to fill enter screen.\n * e.g.\n * ```\n * cameraControls.fitToBox( myMesh );\n * ```\n * @param box3OrObject Axis aligned bounding box to fit the view.\n * @param enableTransition Whether to move smoothly or immediately.\n * @param options | `` { cover: boolean, paddingTop: number, paddingLeft: number, paddingBottom: number, paddingRight: number }\n * @returns Transition end promise\n * @category Methods\n */\n fitToBox(box3OrObject, enableTransition, { cover = false, paddingLeft = 0, paddingRight = 0, paddingBottom = 0, paddingTop = 0 } = {}) {\n const promises = [];\n const aabb = box3OrObject.isBox3\n ? _box3A.copy(box3OrObject)\n : _box3A.setFromObject(box3OrObject);\n if (aabb.isEmpty()) {\n console.warn('camera-controls: fitTo() cannot be used with an empty box. Aborting');\n Promise.resolve();\n }\n // round to closest axis ( forward | backward | right | left | top | bottom )\n const theta = roundToStep(this._sphericalEnd.theta, PI_HALF);\n const phi = roundToStep(this._sphericalEnd.phi, PI_HALF);\n promises.push(this.rotateTo(theta, phi, enableTransition));\n const normal = _v3A.setFromSpherical(this._sphericalEnd).normalize();\n const rotation = _quaternionA.setFromUnitVectors(normal, _AXIS_Z);\n const viewFromPolar = approxEquals(Math.abs(normal.y), 1);\n if (viewFromPolar) {\n rotation.multiply(_quaternionB.setFromAxisAngle(_AXIS_Y, theta));\n }\n rotation.multiply(this._yAxisUpSpaceInverse);\n // make oriented bounding box\n const bb = _box3B.makeEmpty();\n // left bottom back corner\n _v3B.copy(aabb.min).applyQuaternion(rotation);\n bb.expandByPoint(_v3B);\n // right bottom back corner\n _v3B.copy(aabb.min).setX(aabb.max.x).applyQuaternion(rotation);\n bb.expandByPoint(_v3B);\n // left top back corner\n _v3B.copy(aabb.min).setY(aabb.max.y).applyQuaternion(rotation);\n bb.expandByPoint(_v3B);\n // right top back corner\n _v3B.copy(aabb.max).setZ(aabb.min.z).applyQuaternion(rotation);\n bb.expandByPoint(_v3B);\n // left bottom front corner\n _v3B.copy(aabb.min).setZ(aabb.max.z).applyQuaternion(rotation);\n bb.expandByPoint(_v3B);\n // right bottom front corner\n _v3B.copy(aabb.max).setY(aabb.min.y).applyQuaternion(rotation);\n bb.expandByPoint(_v3B);\n // left top front corner\n _v3B.copy(aabb.max).setX(aabb.min.x).applyQuaternion(rotation);\n bb.expandByPoint(_v3B);\n // right top front corner\n _v3B.copy(aabb.max).applyQuaternion(rotation);\n bb.expandByPoint(_v3B);\n // add padding\n bb.min.x -= paddingLeft;\n bb.min.y -= paddingBottom;\n bb.max.x += paddingRight;\n bb.max.y += paddingTop;\n rotation.setFromUnitVectors(_AXIS_Z, normal);\n if (viewFromPolar) {\n rotation.premultiply(_quaternionB.invert());\n }\n rotation.premultiply(this._yAxisUpSpace);\n const bbSize = bb.getSize(_v3A);\n const center = bb.getCenter(_v3B).applyQuaternion(rotation);\n if (isPerspectiveCamera(this._camera)) {\n const distance = this.getDistanceToFitBox(bbSize.x, bbSize.y, bbSize.z, cover);\n promises.push(this.moveTo(center.x, center.y, center.z, enableTransition));\n promises.push(this.dollyTo(distance, enableTransition));\n promises.push(this.setFocalOffset(0, 0, 0, enableTransition));\n }\n else if (isOrthographicCamera(this._camera)) {\n const camera = this._camera;\n const width = camera.right - camera.left;\n const height = camera.top - camera.bottom;\n const zoom = cover ? Math.max(width / bbSize.x, height / bbSize.y) : Math.min(width / bbSize.x, height / bbSize.y);\n promises.push(this.moveTo(center.x, center.y, center.z, enableTransition));\n promises.push(this.zoomTo(zoom, enableTransition));\n promises.push(this.setFocalOffset(0, 0, 0, enableTransition));\n }\n return Promise.all(promises);\n }\n /**\n * Fit the viewport to the sphere or the bounding sphere of the object.\n * @param sphereOrMesh\n * @param enableTransition\n * @category Methods\n */\n fitToSphere(sphereOrMesh, enableTransition) {\n const promises = [];\n const isSphere = sphereOrMesh instanceof THREE.Sphere;\n const boundingSphere = isSphere ?\n _sphere.copy(sphereOrMesh) :\n createBoundingSphere(sphereOrMesh, _sphere);\n promises.push(this.moveTo(boundingSphere.center.x, boundingSphere.center.y, boundingSphere.center.z, enableTransition));\n if (isPerspectiveCamera(this._camera)) {\n const distanceToFit = this.getDistanceToFitSphere(boundingSphere.radius);\n promises.push(this.dollyTo(distanceToFit, enableTransition));\n }\n else if (isOrthographicCamera(this._camera)) {\n const width = this._camera.right - this._camera.left;\n const height = this._camera.top - this._camera.bottom;\n const diameter = 2 * boundingSphere.radius;\n const zoom = Math.min(width / diameter, height / diameter);\n promises.push(this.zoomTo(zoom, enableTransition));\n }\n promises.push(this.setFocalOffset(0, 0, 0, enableTransition));\n return Promise.all(promises);\n }\n /**\n * Make an orbit with given points.\n * @param positionX\n * @param positionY\n * @param positionZ\n * @param targetX\n * @param targetY\n * @param targetZ\n * @param enableTransition\n * @category Methods\n */\n setLookAt(positionX, positionY, positionZ, targetX, targetY, targetZ, enableTransition = false) {\n const target = _v3B.set(targetX, targetY, targetZ);\n const position = _v3A.set(positionX, positionY, positionZ);\n this._targetEnd.copy(target);\n this._sphericalEnd.setFromVector3(position.sub(target).applyQuaternion(this._yAxisUpSpace));\n this.normalizeRotations();\n this._needsUpdate = true;\n if (!enableTransition) {\n this._target.copy(this._targetEnd);\n this._spherical.copy(this._sphericalEnd);\n }\n const resolveImmediately = !enableTransition ||\n approxEquals(this._target.x, this._targetEnd.x, this.restThreshold) &&\n approxEquals(this._target.y, this._targetEnd.y, this.restThreshold) &&\n approxEquals(this._target.z, this._targetEnd.z, this.restThreshold) &&\n approxEquals(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) &&\n approxEquals(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) &&\n approxEquals(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);\n return this._createOnRestPromise(resolveImmediately);\n }\n /**\n * Similar to setLookAt, but it interpolates between two states.\n * @param positionAX\n * @param positionAY\n * @param positionAZ\n * @param targetAX\n * @param targetAY\n * @param targetAZ\n * @param positionBX\n * @param positionBY\n * @param positionBZ\n * @param targetBX\n * @param targetBY\n * @param targetBZ\n * @param t\n * @param enableTransition\n * @category Methods\n */\n lerpLookAt(positionAX, positionAY, positionAZ, targetAX, targetAY, targetAZ, positionBX, positionBY, positionBZ, targetBX, targetBY, targetBZ, t, enableTransition = false) {\n const targetA = _v3A.set(targetAX, targetAY, targetAZ);\n const positionA = _v3B.set(positionAX, positionAY, positionAZ);\n _sphericalA.setFromVector3(positionA.sub(targetA).applyQuaternion(this._yAxisUpSpace));\n const targetB = _v3C.set(targetBX, targetBY, targetBZ);\n const positionB = _v3B.set(positionBX, positionBY, positionBZ);\n _sphericalB.setFromVector3(positionB.sub(targetB).applyQuaternion(this._yAxisUpSpace));\n this._targetEnd.copy(targetA.lerp(targetB, t)); // tricky\n const deltaTheta = _sphericalB.theta - _sphericalA.theta;\n const deltaPhi = _sphericalB.phi - _sphericalA.phi;\n const deltaRadius = _sphericalB.radius - _sphericalA.radius;\n this._sphericalEnd.set(_sphericalA.radius + deltaRadius * t, _sphericalA.phi + deltaPhi * t, _sphericalA.theta + deltaTheta * t);\n this.normalizeRotations();\n this._needsUpdate = true;\n if (!enableTransition) {\n this._target.copy(this._targetEnd);\n this._spherical.copy(this._sphericalEnd);\n }\n const resolveImmediately = !enableTransition ||\n approxEquals(this._target.x, this._targetEnd.x, this.restThreshold) &&\n approxEquals(this._target.y, this._targetEnd.y, this.restThreshold) &&\n approxEquals(this._target.z, this._targetEnd.z, this.restThreshold) &&\n approxEquals(this._spherical.theta, this._sphericalEnd.theta, this.restThreshold) &&\n approxEquals(this._spherical.phi, this._sphericalEnd.phi, this.restThreshold) &&\n approxEquals(this._spherical.radius, this._sphericalEnd.radius, this.restThreshold);\n return this._createOnRestPromise(resolveImmediately);\n }\n /**\n * setLookAt without target, keep gazing at the current target\n * @param positionX\n * @param positionY\n * @param positionZ\n * @param enableTransition\n * @category Methods\n */\n setPosition(positionX, positionY, positionZ, enableTransition = false) {\n return this.setLookAt(positionX, positionY, positionZ, this._targetEnd.x, this._targetEnd.y, this._targetEnd.z, enableTransition);\n }\n /**\n * setLookAt without position, Stay still at the position.\n * @param targetX\n * @param targetY\n * @param targetZ\n * @param enableTransition\n * @category Methods\n */\n setTarget(targetX, targetY, targetZ, enableTransition = false) {\n const pos = this.getPosition(_v3A);\n const promise = this.setLookAt(pos.x, pos.y, pos.z, targetX, targetY, targetZ, enableTransition);\n // see https://github.com/yomotsu/camera-controls/issues/335\n this._sphericalEnd.phi = THREE.MathUtils.clamp(this.polarAngle, this.minPolarAngle, this.maxPolarAngle);\n return promise;\n }\n /**\n * Set focal offset using the screen parallel coordinates. z doesn't affect in Orthographic as with Dolly.\n * @param x\n * @param y\n * @param z\n * @param enableTransition\n * @category Methods\n */\n setFocalOffset(x, y, z, enableTransition = false) {\n this._focalOffsetEnd.set(x, y, z);\n this._needsUpdate = true;\n if (!enableTransition) {\n this._focalOffset.copy(this._focalOffsetEnd);\n }\n this._affectOffset =\n !approxZero(x) ||\n !approxZero(y) ||\n !approxZero(z);\n const resolveImmediately = !enableTransition ||\n approxEquals(this._focalOffset.x, this._focalOffsetEnd.x, this.restThreshold) &&\n approxEquals(this._focalOffset.y, this._focalOffsetEnd.y, this.restThreshold) &&\n approxEquals(this._focalOffset.z, this._focalOffsetEnd.z, this.restThreshold);\n return this._createOnRestPromise(resolveImmediately);\n }\n /**\n * Set orbit point without moving the camera.\n * SHOULD NOT RUN DURING ANIMATIONS. `setOrbitPoint()` will immediately fix the positions.\n * @param targetX\n * @param targetY\n * @param targetZ\n * @category Methods\n */\n setOrbitPoint(targetX, targetY, targetZ) {\n this._camera.updateMatrixWorld();\n _xColumn.setFromMatrixColumn(this._camera.matrixWorldInverse, 0);\n _yColumn.setFromMatrixColumn(this._camera.matrixWorldInverse, 1);\n _zColumn.setFromMatrixColumn(this._camera.matrixWorldInverse, 2);\n const position = _v3A.set(targetX, targetY, targetZ);\n const distance = position.distanceTo(this._camera.position);\n const cameraToPoint = position.sub(this._camera.position);\n _xColumn.multiplyScalar(cameraToPoint.x);\n _yColumn.multiplyScalar(cameraToPoint.y);\n _zColumn.multiplyScalar(cameraToPoint.z);\n _v3A.copy(_xColumn).add(_yColumn).add(_zColumn);\n _v3A.z = _v3A.z + distance;\n this.dollyTo(distance, false);\n this.setFocalOffset(-_v3A.x, _v3A.y, -_v3A.z, false);\n this.moveTo(targetX, targetY, targetZ, false);\n }\n /**\n * Set the boundary box that encloses the target of the camera. box3 is in THREE.Box3\n * @param box3\n * @category Methods\n */\n setBoundary(box3) {\n if (!box3) {\n this._boundary.min.set(-Infinity, -Infinity, -Infinity);\n this._boundary.max.set(Infinity, Infinity, Infinity);\n this._needsUpdate = true;\n return;\n }\n this._boundary.copy(box3);\n this._boundary.clampPoint(this._targetEnd, this._targetEnd);\n this._needsUpdate = true;\n }\n /**\n * Set (or unset) the current viewport.\n * Set this when you want to use renderer viewport and .dollyToCursor feature at the same time.\n * @param viewportOrX\n * @param y\n * @param width\n * @param height\n * @category Methods\n */\n setViewport(viewportOrX, y, width, height) {\n if (viewportOrX === null) { // null\n this._viewport = null;\n return;\n }\n this._viewport = this._viewport || new THREE.Vector4();\n if (typeof viewportOrX === 'number') { // number\n this._viewport.set(viewportOrX, y, width, height);\n }\n else { // Vector4\n this._viewport.copy(viewportOrX);\n }\n }\n /**\n * Calculate the distance to fit the box.\n * @param width box width\n * @param height box height\n * @param depth box depth\n * @returns distance\n * @category Methods\n */\n getDistanceToFitBox(width, height, depth, cover = false) {\n if (notSupportedInOrthographicCamera(this._camera, 'getDistanceToFitBox'))\n return this._spherical.radius;\n const boundingRectAspect = width / height;\n const fov = this._camera.getEffectiveFOV() * THREE.MathUtils.DEG2RAD;\n const aspect = this._camera.aspect;\n const heightToFit = (cover ? boundingRectAspect > aspect : boundingRectAspect < aspect) ? height : width / aspect;\n return heightToFit * 0.5 / Math.tan(fov * 0.5) + depth * 0.5;\n }\n /**\n * Calculate the distance to fit the sphere.\n * @param radius sphere radius\n * @returns distance\n * @category Methods\n */\n getDistanceToFitSphere(radius) {\n if (notSupportedInOrthographicCamera(this._camera, 'getDistanceToFitSphere'))\n return this._spherical.radius;\n // https://stackoverflow.com/a/44849975\n const vFOV = this._camera.getEffectiveFOV() * THREE.MathUtils.DEG2RAD;\n const hFOV = Math.atan(Math.tan(vFOV * 0.5) * this._camera.aspect) * 2;\n const fov = 1 < this._camera.aspect ? vFOV : hFOV;\n return radius / (Math.sin(fov * 0.5));\n }\n /**\n * Returns its current gazing target, which is the center position of the orbit.\n * @param out current gazing target\n * @category Methods\n */\n getTarget(out) {\n const _out = !!out && out.isVector3 ? out : new THREE.Vector3();\n return _out.copy(this._targetEnd);\n }\n /**\n * Returns its current position.\n * @param out current position\n * @category Methods\n */\n getPosition(out) {\n const _out = !!out && out.isVector3 ? out : new THREE.Vector3();\n return _out.setFromSpherical(this._sphericalEnd).applyQuaternion(this._yAxisUpSpaceInverse).add(this._targetEnd);\n }\n /**\n * Returns its current focal offset, which is how much the camera appears to be translated in screen parallel coordinates.\n * @param out current focal offset\n * @category Methods\n */\n getFocalOffset(out) {\n const _out = !!out && out.isVector3 ? out : new THREE.Vector3();\n return _out.copy(this._focalOffsetEnd);\n }\n /**\n * Normalize camera azimuth angle rotation between 0 and 360 degrees.\n * @category Methods\n */\n normalizeRotations() {\n this._sphericalEnd.theta = this._sphericalEnd.theta % PI_2;\n if (this._sphericalEnd.theta < 0)\n this._sphericalEnd.theta += PI_2;\n this._spherical.theta += PI_2 * Math.round((this._sphericalEnd.theta - this._spherical.theta) / PI_2);\n }\n /**\n * Reset all rotation and position to defaults.\n * @param enableTransition\n * @category Methods\n */\n reset(enableTransition = false) {\n const promises = [\n this.setLookAt(this._position0.x, this._position0.y, this._position0.z, this._target0.x, this._target0.y, this._target0.z, enableTransition),\n this.setFocalOffset(this._focalOffset0.x, this._focalOffset0.y, this._focalOffset0.z, enableTransition),\n this.zoomTo(this._zoom0, enableTransition),\n ];\n return Promise.all(promises);\n }\n /**\n * Set current camera position as the default position.\n * @category Methods\n */\n saveState() {\n this.getTarget(this._target0);\n this.getPosition(this._position0);\n this._zoom0 = this._zoom;\n this._focalOffset0.copy(this._focalOffset);\n }\n /**\n * Sync camera-up direction.\n * When camera-up vector is changed, `.updateCameraUp()` must be called.\n * @category Methods\n */\n updateCameraUp() {\n this._yAxisUpSpace.setFromUnitVectors(this._camera.up, _AXIS_Y);\n quatInvertCompat(this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace));\n }\n /**\n * Update camera position and directions.\n * This should be called in your tick loop every time, and returns true if re-rendering is needed.\n * @param delta\n * @returns updated\n * @category Methods\n */\n update(delta) {\n const dampingFactor = this._state === ACTION.NONE ? this.dampingFactor : this.draggingDampingFactor;\n // The original THREE.OrbitControls assume 60 FPS fixed and does NOT rely on delta time.\n // (that must be a problem of the original one though)\n // To to emulate the speed of the original one under 60 FPS, multiply `60` to delta,\n // but ours are more flexible to any FPS unlike the original.\n const lerpRatio = Math.min(dampingFactor * delta * 60, 1);\n const deltaTheta = this._sphericalEnd.theta - this._spherical.theta;\n const deltaPhi = this._sphericalEnd.phi - this._spherical.phi;\n const deltaRadius = this._sphericalEnd.radius - this._spherical.radius;\n const deltaTarget = _deltaTarget.subVectors(this._targetEnd, this._target);\n const deltaOffset = _deltaOffset.subVectors(this._focalOffsetEnd, this._focalOffset);\n if (!approxZero(deltaTheta) ||\n !approxZero(deltaPhi) ||\n !approxZero(deltaRadius) ||\n !approxZero(deltaTarget.x) ||\n !approxZero(deltaTarget.y) ||\n !approxZero(deltaTarget.z) ||\n !approxZero(deltaOffset.x) ||\n !approxZero(deltaOffset.y) ||\n !approxZero(deltaOffset.z)) {\n this._spherical.set(this._spherical.radius + deltaRadius * lerpRatio, this._spherical.phi + deltaPhi * lerpRatio, this._spherical.theta + deltaTheta * lerpRatio);\n this._target.add(deltaTarget.multiplyScalar(lerpRatio));\n this._focalOffset.add(deltaOffset.multiplyScalar(lerpRatio));\n this._needsUpdate = true;\n }\n else {\n this._spherical.copy(this._sphericalEnd);\n this._target.copy(this._targetEnd);\n this._focalOffset.copy(this._focalOffsetEnd);\n }\n if (this._dollyControlAmount !== 0) {\n if (isPerspectiveCamera(this._camera)) {\n const camera = this._camera;\n const cameraDirection = _v3A.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).normalize().negate();\n const planeX = _v3B.copy(cameraDirection).cross(camera.up).normalize();\n if (planeX.lengthSq() === 0)\n planeX.x = 1.0;\n const planeY = _v3C.crossVectors(planeX, cameraDirection);\n const worldToScreen = this._sphericalEnd.radius * Math.tan(camera.getEffectiveFOV() * THREE.MathUtils.DEG2RAD * 0.5);\n const prevRadius = this._sphericalEnd.radius - this._dollyControlAmount;\n const lerpRatio = (prevRadius - this._sphericalEnd.radius) / this._sphericalEnd.radius;\n const cursor = _v3A.copy(this._targetEnd)\n .add(planeX.multiplyScalar(this._dollyControlCoord.x * worldToScreen * camera.aspect))\n .add(planeY.multiplyScalar(this._dollyControlCoord.y * worldToScreen));\n this._targetEnd.lerp(cursor, lerpRatio);\n }\n else if (isOrthographicCamera(this._camera)) {\n const camera = this._camera;\n const worldCursorPosition = _v3A.set(this._dollyControlCoord.x, this._dollyControlCoord.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); //.sub( _v3B.set( this._focalOffset.x, this._focalOffset.y, 0 ) );\n const quaternion = _v3B.set(0, 0, -1).applyQuaternion(camera.quaternion);\n const cursor = _v3C.copy(worldCursorPosition).add(quaternion.multiplyScalar(-worldCursorPosition.dot(camera.up)));\n const prevZoom = this._zoom - this._dollyControlAmount;\n const lerpRatio = -(prevZoom - this._zoomEnd) / this._zoom;\n // find the \"distance\" (aka plane constant in three.js) of Plane\n // from a given position (this._targetEnd) and normal vector (cameraDirection)\n // https://www.maplesoft.com/support/help/maple/view.aspx?path=MathApps%2FEquationOfAPlaneNormal#bkmrk0\n const cameraDirection = _v3A.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).normalize().negate();\n const prevPlaneConstant = this._targetEnd.dot(cameraDirection);\n this._targetEnd.lerp(cursor, lerpRatio);\n const newPlaneConstant = this._targetEnd.dot(cameraDirection);\n // Pull back the camera depth that has moved, to be the camera stationary as zoom\n const pullBack = cameraDirection.multiplyScalar(newPlaneConstant - prevPlaneConstant);\n this._targetEnd.sub(pullBack);\n }\n this._target.copy(this._targetEnd);\n // target position may be moved beyond boundary.\n this._boundary.clampPoint(this._targetEnd, this._targetEnd);\n this._dollyControlAmount = 0;\n }\n // zoom\n const deltaZoom = this._zoomEnd - this._zoom;\n this._zoom += deltaZoom * lerpRatio;\n if (this._camera.zoom !== this._zoom) {\n if (approxZero(deltaZoom))\n this._zoom = this._zoomEnd;\n this._camera.zoom = this._zoom;\n this._camera.updateProjectionMatrix();\n this._updateNearPlaneCorners();\n this._needsUpdate = true;\n }\n // collision detection\n const maxDistance = this._collisionTest();\n this._spherical.radius = Math.min(this._spherical.radius, maxDistance);\n // decompose spherical to the camera position\n this._spherical.makeSafe();\n this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target);\n this._camera.lookAt(this._target);\n // set offset after the orbit movement\n if (this._affectOffset) {\n this._camera.updateMatrixWorld();\n _xColumn.setFromMatrixColumn(this._camera.matrix, 0);\n _yColumn.setFromMatrixColumn(this._camera.matrix, 1);\n _zColumn.setFromMatrixColumn(this._camera.matrix, 2);\n _xColumn.multiplyScalar(this._focalOffset.x);\n _yColumn.multiplyScalar(-this._focalOffset.y);\n _zColumn.multiplyScalar(this._focalOffset.z); // notice: z-offset will not affect in Orthographic.\n _v3A.copy(_xColumn).add(_yColumn).add(_zColumn);\n this._camera.position.add(_v3A);\n }\n if (this._boundaryEnclosesCamera) {\n this._encloseToBoundary(this._camera.position.copy(this._target), _v3A.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse), 1.0);\n }\n const updated = this._needsUpdate;\n if (updated && !this._updatedLastTime) {\n this._hasRested = false;\n this.dispatchEvent({ type: 'wake' });\n this.dispatchEvent({ type: 'update' });\n }\n else if (updated) {\n this.dispatchEvent({ type: 'update' });\n if (approxZero(deltaTheta, this.restThreshold) &&\n approxZero(deltaPhi, this.restThreshold) &&\n approxZero(deltaRadius, this.restThreshold) &&\n approxZero(deltaTarget.x, this.restThreshold) &&\n approxZero(deltaTarget.y, this.restThreshold) &&\n approxZero(deltaTarget.z, this.restThreshold) &&\n approxZero(deltaOffset.x, this.restThreshold) &&\n approxZero(deltaOffset.y, this.restThreshold) &&\n approxZero(deltaOffset.z, this.restThreshold) &&\n approxZero(deltaZoom, this.restThreshold) &&\n !this._hasRested) {\n this._hasRested = true;\n this.dispatchEvent({ type: 'rest' });\n }\n }\n else if (!updated && this._updatedLastTime) {\n this.dispatchEvent({ type: 'sleep' });\n }\n this._updatedLastTime = updated;\n this._needsUpdate = false;\n return updated;\n }\n /**\n * Get all state in JSON string\n * @category Methods\n */\n toJSON() {\n return JSON.stringify({\n enabled: this._enabled,\n minDistance: this.minDistance,\n maxDistance: infinityToMaxNumber(this.maxDistance),\n minZoom: this.minZoom,\n maxZoom: infinityToMaxNumber(this.maxZoom),\n minPolarAngle: this.minPolarAngle,\n maxPolarAngle: infinityToMaxNumber(this.maxPolarAngle),\n minAzimuthAngle: infinityToMaxNumber(this.minAzimuthAngle),\n maxAzimuthAngle: infinityToMaxNumber(this.maxAzimuthAngle),\n dampingFactor: this.dampingFactor,\n draggingDampingFactor: this.draggingDampingFactor,\n dollySpeed: this.dollySpeed,\n truckSpeed: this.truckSpeed,\n dollyToCursor: this.dollyToCursor,\n verticalDragToForward: this.verticalDragToForward,\n target: this._targetEnd.toArray(),\n position: _v3A.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),\n zoom: this._zoomEnd,\n focalOffset: this._focalOffsetEnd.toArray(),\n target0: this._target0.toArray(),\n position0: this._position0.toArray(),\n zoom0: this._zoom0,\n focalOffset0: this._focalOffset0.toArray(),\n });\n }\n /**\n * Reproduce the control state with JSON. enableTransition is where anim or not in a boolean.\n * @param json\n * @param enableTransition\n * @category Methods\n */\n fromJSON(json, enableTransition = false) {\n const obj = JSON.parse(json);\n const position = _v3A.fromArray(obj.position);\n this.enabled = obj.enabled;\n this.minDistance = obj.minDistance;\n this.maxDistance = maxNumberToInfinity(obj.maxDistance);\n this.minZoom = obj.minZoom;\n this.maxZoom = maxNumberToInfinity(obj.maxZoom);\n this.minPolarAngle = obj.minPolarAngle;\n this.maxPolarAngle = maxNumberToInfinity(obj.maxPolarAngle);\n this.minAzimuthAngle = maxNumberToInfinity(obj.minAzimuthAngle);\n this.maxAzimuthAngle = maxNumberToInfinity(obj.maxAzimuthAngle);\n this.dampingFactor = obj.dampingFactor;\n this.draggingDampingFactor = obj.draggingDampingFactor;\n this.dollySpeed = obj.dollySpeed;\n this.truckSpeed = obj.truckSpeed;\n this.dollyToCursor = obj.dollyToCursor;\n this.verticalDragToForward = obj.verticalDragToForward;\n this._target0.fromArray(obj.target0);\n this._position0.fromArray(obj.position0);\n this._zoom0 = obj.zoom0;\n this._focalOffset0.fromArray(obj.focalOffset0);\n this.moveTo(obj.target[0], obj.target[1], obj.target[2], enableTransition);\n _sphericalA.setFromVector3(position.sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace));\n this.rotateTo(_sphericalA.theta, _sphericalA.phi, enableTransition);\n this.zoomTo(obj.zoom, enableTransition);\n this.setFocalOffset(obj.focalOffset[0], obj.focalOffset[1], obj.focalOffset[2], enableTransition);\n this._needsUpdate = true;\n }\n /**\n * Attach all internal event handlers to enable drag control.\n * @category Methods\n */\n connect(domElement) {\n if (this._domElement) {\n console.warn('camera-controls is already connected.');\n return;\n }\n domElement.setAttribute('data-camera-controls-version', VERSION);\n this._addAllEventListeners(domElement);\n }\n /**\n * Detach all internal event handlers to disable drag control.\n */\n disconnect() {\n this._removeAllEventListeners();\n this._domElement = undefined;\n }\n /**\n * Dispose the cameraControls instance itself, remove all eventListeners.\n * @category Methods\n */\n dispose() {\n this.disconnect();\n if (this._domElement && 'setAttribute' in this._domElement)\n this._domElement.removeAttribute('data-camera-controls-version');\n }\n _findPointerById(pointerId) {\n // to support IE11 use some instead of Array#find (will be removed when IE11 is deprecated)\n let pointer = null;\n this._activePointers.some((activePointer) => {\n if (activePointer.pointerId === pointerId) {\n pointer = activePointer;\n return true;\n }\n return false;\n });\n return pointer;\n }\n _encloseToBoundary(position, offset, friction) {\n const offsetLength2 = offset.lengthSq();\n if (offsetLength2 === 0.0) { // sanity check\n return position;\n }\n // See: https://twitter.com/FMS_Cat/status/1106508958640988161\n const newTarget = _v3B.copy(offset).add(position); // target\n const clampedTarget = this._boundary.clampPoint(newTarget, _v3C); // clamped target\n const deltaClampedTarget = clampedTarget.sub(newTarget); // newTarget -> clampedTarget\n const deltaClampedTargetLength2 = deltaClampedTarget.lengthSq(); // squared length of deltaClampedTarget\n if (deltaClampedTargetLength2 === 0.0) { // when the position doesn't have to be clamped\n return position.add(offset);\n }\n else if (deltaClampedTargetLength2 === offsetLength2) { // when the position is completely stuck\n return position;\n }\n else if (friction === 0.0) {\n return position.add(offset).add(deltaClampedTarget);\n }\n else {\n const offsetFactor = 1.0 + friction * deltaClampedTargetLength2 / offset.dot(deltaClampedTarget);\n return position\n .add(_v3B.copy(offset).multiplyScalar(offsetFactor))\n .add(deltaClampedTarget.multiplyScalar(1.0 - friction));\n }\n }\n _updateNearPlaneCorners() {\n if (isPerspectiveCamera(this._camera)) {\n const camera = this._camera;\n const near = camera.near;\n const fov = camera.getEffectiveFOV() * THREE.MathUtils.DEG2RAD;\n const heightHalf = Math.tan(fov * 0.5) * near; // near plain half height\n const widthHalf = heightHalf * camera.aspect; // near plain half width\n this._nearPlaneCorners[0].set(-widthHalf, -heightHalf, 0);\n this._nearPlaneCorners[1].set(widthHalf, -heightHalf, 0);\n this._nearPlaneCorners[2].set(widthHalf, heightHalf, 0);\n this._nearPlaneCorners[3].set(-widthHalf, heightHalf, 0);\n }\n else if (isOrthographicCamera(this._camera)) {\n const camera = this._camera;\n const zoomInv = 1 / camera.zoom;\n const left = camera.left * zoomInv;\n const right = camera.right * zoomInv;\n const top = camera.top * zoomInv;\n const bottom = camera.bottom * zoomInv;\n this._nearPlaneCorners[0].set(left, top, 0);\n this._nearPlaneCorners[1].set(right, top, 0);\n this._nearPlaneCorners[2].set(right, bottom, 0);\n this._nearPlaneCorners[3].set(left, bottom, 0);\n }\n }\n // lateUpdate\n _collisionTest() {\n let distance = Infinity;\n const hasCollider = this.colliderMeshes.length >= 1;\n if (!hasCollider)\n return distance;\n if (notSupportedInOrthographicCamera(this._camera, '_collisionTest'))\n return distance;\n // divide by distance to normalize, lighter than `Vector3.prototype.normalize()`\n const direction = _v3A.setFromSpherical(this._spherical).divideScalar(this._spherical.radius);\n _rotationMatrix.lookAt(_ORIGIN, direction, this._camera.up);\n for (let i = 0; i < 4; i++) {\n const nearPlaneCorner = _v3B.copy(this._nearPlaneCorners[i]);\n nearPlaneCorner.applyMatrix4(_rotationMatrix);\n const origin = _v3C.addVectors(this._target, nearPlaneCorner);\n _raycaster.set(origin, direction);\n _raycaster.far = this._spherical.radius + 1;\n const intersects = _raycaster.intersectObjects(this.colliderMeshes);\n if (intersects.length !== 0 && intersects[0].distance < distance) {\n distance = intersects[0].distance;\n }\n }\n return distance;\n }\n /**\n * Get its client rect and package into given `DOMRect` .\n */\n _getClientRect(target) {\n if (!this._domElement)\n return;\n const rect = this._domElement.getBoundingClientRect();\n target.x = rect.left;\n target.y = rect.top;\n if (this._viewport) {\n target.x += this._viewport.x;\n target.y += rect.height - this._viewport.w - this._viewport.y;\n target.width = this._viewport.z;\n target.height = this._viewport.w;\n }\n else {\n target.width = rect.width;\n target.height = rect.height;\n }\n return target;\n }\n _createOnRestPromise(resolveImmediately) {\n if (resolveImmediately)\n return Promise.resolve();\n this._hasRested = false;\n this.dispatchEvent({ type: 'transitionstart' });\n return new Promise((resolve) => {\n const onResolve = () => {\n this.removeEventListener('rest', onResolve);\n resolve();\n };\n this.addEventListener('rest', onResolve);\n });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _addAllEventListeners(_domElement) { }\n _removeAllEventListeners() { }\n}\nfunction createBoundingSphere(object3d, out) {\n const boundingSphere = out;\n const center = boundingSphere.center;\n _box3A.makeEmpty();\n // find the center\n object3d.traverseVisible((object) => {\n if (!object.isMesh)\n return;\n _box3A.expandByObject(object);\n });\n _box3A.getCenter(center);\n // find the radius\n let maxRadiusSq = 0;\n object3d.traverseVisible((object) => {\n if (!object.isMesh)\n return;\n const mesh = object;\n const geometry = mesh.geometry.clone();\n geometry.applyMatrix4(mesh.matrixWorld);\n if (geometry.isBufferGeometry) {\n const bufferGeometry = geometry;\n const position = bufferGeometry.attributes.position;\n for (let i = 0, l = position.count; i < l; i++) {\n _v3A.fromBufferAttribute(position, i);\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_v3A));\n }\n }\n else {\n // for old three.js, which supports both BufferGeometry and Geometry\n // this condition block will be removed in the near future.\n const position = geometry.attributes.position;\n const vector = new THREE.Vector3();\n for (let i = 0, l = position.count; i < l; i++) {\n vector.fromBufferAttribute(position, i);\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(vector));\n }\n }\n });\n boundingSphere.radius = Math.sqrt(maxRadiusSq);\n return boundingSphere;\n}\n\nexport { CameraControls as default };\n"],"names":["ACTION","Object","freeze","NONE","ROTATE","TRUCK","OFFSET","DOLLY","ZOOM","TOUCH_ROTATE","TOUCH_TRUCK","TOUCH_OFFSET","TOUCH_DOLLY","TOUCH_ZOOM","TOUCH_DOLLY_TRUCK","TOUCH_DOLLY_OFFSET","TOUCH_DOLLY_ROTATE","TOUCH_ZOOM_TRUCK","TOUCH_ZOOM_OFFSET","TOUCH_ZOOM_ROTATE","isPerspectiveCamera","camera","isOrthographicCamera","PI_2","Math","PI","PI_HALF","EPSILON","approxZero","number","error","abs","approxEquals","a","b","roundToStep","value","step","round","infinityToMaxNumber","isFinite","Number","MAX_VALUE","maxNumberToInfinity","Infinity","extractClientCoordFromEvent","pointers","out","set","forEach","pointer","x","clientX","y","clientY","length","notSupportedInOrthographicCamera","message","console","warn","quatInvertCompat","target","invert","inverse","EventDispatcher","constructor","this","_listeners","addEventListener","type","listener","listeners","undefined","indexOf","push","hasEventListener","removeEventListener","listenerArray","index","splice","removeAllEventListeners","Array","isArray","dispatchEvent","event","array","slice","i","l","call","TOUCH_DOLLY_FACTOR","isBrowser","window","isMac","test","navigator","platform","isPointerEventsNotSupported","THREE","_ORIGIN","_AXIS_Y","_AXIS_Z","_v2","_v3A","_v3B","_v3C","_xColumn","_yColumn","_zColumn","_deltaTarget","_deltaOffset","_sphericalA","_sphericalB","_box3A","_box3B","_sphere","_quaternionA","_quaternionB","_rotationMatrix","_raycaster","CameraControls","static","libs","Vector3","Vector2","Spherical","Box3","Sphere","Quaternion","Matrix4","Raycaster","domElement","super","minPolarAngle","maxPolarAngle","minAzimuthAngle","maxAzimuthAngle","minDistance","maxDistance","infinityDolly","minZoom","maxZoom","dampingFactor","draggingDampingFactor","azimuthRotateSpeed","polarRotateSpeed","dollySpeed","truckSpeed","dollyToCursor","dragToOffset","verticalDragToForward","boundaryFriction","restThreshold","colliderMeshes","cancel","_enabled","_state","_viewport","_affectOffset","_dollyControlAmount","_hasRested","_boundaryEnclosesCamera","_needsUpdate","_updatedLastTime","_elementRect","DOMRect","_activePointers","_truckInternal","deltaX","deltaY","_camera","offset","copy","position","sub","_target","fov","getEffectiveFOV","MathUtils","DEG2RAD","targetDistance","tan","truckX","height","pedestalY","setFocalOffset","_focalOffsetEnd","z","truck","forward","right","left","zoom","width","top","bottom","_rotateInternal","theta","phi","rotate","_dollyInternal","delta","dollyScale","pow","distance","_sphericalEnd","radius","prevRadius","signedPrevRadius","dollyTo","getWorldDirection","_targetEnd","add","normalize","multiplyScalar","_dollyControlCoord","_zoomInternal","zoomScale","prevZoom","_zoomEnd","zoomTo","_zoom","_yAxisUpSpace","setFromUnitVectors","up","_yAxisUpSpaceInverse","clone","_focalOffset","_spherical","setFromVector3","applyQuaternion","_nearPlaneCorners","_updateNearPlaneCorners","_boundary","_target0","_position0","_zoom0","_focalOffset0","mouseButtons","middle","wheel","touches","one","two","three","dragStartPosition","lastDragPosition","dollyStart","onPointerDown","_domElement","pointerId","ownerDocument","onPointerMove","passive","onPointerUp","startDragging","onMouseDown","onMouseMove","onMouseUp","onTouchStart","preventDefault","prototype","changedTouches","touch","identifier","onTouchMove","onTouchEnd","cancelable","_findPointerById","movementX","movementY","pointerType","buttons","dragging","endDragging","lastScrollTimeStamp","onMouseWheel","now","performance","_getClientRect","deltaYFactor","deltaMode","onContextMenu","dx","dy","sqrt","isPointerLockActive","document","pointerLockElement","dollyX","dollyY","dollyDelta","_addAllEventListeners","style","touchAction","userSelect","webkitUserSelect","_removeAllEventListeners","connect","update","updateCameraUp","updateProjectionMatrix","enabled","active","currentAction","azimuthAngle","polarAngle","boundaryEnclosesCamera","enableTransition","rotateTo","rotateAzimuthTo","rotatePolarTo","clamp","makeSafe","resolveImmediately","_createOnRestPromise","dolly","lastRadius","newRadius","maxDistanceByCollisionTest","_collisionTest","isCollided","Promise","resolve","min","zoomStep","pan","updateMatrix","setFromMatrixColumn","matrix","to","moveTo","crossVectors","_encloseToBoundary","fitToBox","box3OrObject","cover","paddingLeft","paddingRight","paddingBottom","paddingTop","promises","aabb","isBox3","setFromObject","isEmpty","normal","setFromSpherical","rotation","viewFromPolar","multiply","setFromAxisAngle","bb","makeEmpty","expandByPoint","setX","max","setY","setZ","premultiply","bbSize","getSize","center","getCenter","getDistanceToFitBox","all","fitToSphere","sphereOrMesh","boundingSphere","object3d","traverseVisible","object","isMesh","expandByObject","maxRadiusSq","mesh","geometry","applyMatrix4","matrixWorld","isBufferGeometry","attributes","count","fromBufferAttribute","distanceToSquared","vector","createBoundingSphere","distanceToFit","getDistanceToFitSphere","diameter","setLookAt","positionX","positionY","positionZ","targetX","targetY","targetZ","normalizeRotations","lerpLookAt","positionAX","positionAY","positionAZ","targetAX","targetAY","targetAZ","positionBX","positionBY","positionBZ","targetBX","targetBY","targetBZ","t","targetA","positionA","targetB","positionB","lerp","deltaTheta","deltaPhi","deltaRadius","setPosition","setTarget","pos","getPosition","promise","setOrbitPoint","updateMatrixWorld","matrixWorldInverse","distanceTo","cameraToPoint","setBoundary","box3","clampPoint","setViewport","viewportOrX","Vector4","depth","boundingRectAspect","aspect","vFOV","hFOV","atan","sin","getTarget","isVector3","getFocalOffset","reset","saveState","lerpRatio","deltaTarget","subVectors","deltaOffset","cameraDirection","negate","planeX","cross","lengthSq","planeY","worldToScreen","cursor","worldCursorPosition","near","far","unproject","quaternion","dot","prevPlaneConstant","newPlaneConstant","pullBack","deltaZoom","lookAt","updated","toJSON","JSON","stringify","toArray","focalOffset","target0","position0","zoom0","focalOffset0","fromJSON","json","obj","parse","fromArray","setAttribute","disconnect","dispose","removeAttribute","some","activePointer","friction","offsetLength2","newTarget","deltaClampedTarget","deltaClampedTargetLength2","offsetFactor","heightHalf","widthHalf","zoomInv","direction","divideScalar","nearPlaneCorner","origin","addVectors","intersects","intersectObjects","rect","getBoundingClientRect","w","onResolve"],"sourceRoot":""}