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KzU,QAElBtL,CACX,CACA,oBAAAkU,CAAqBD,GACjB,OAAIA,EACOQ,EAAQC,WACnBzR,KAAK+F,YAAa,EAClB/F,KAAKiB,cAAc,CAAEd,KAAM,oBACpB,IAAIqR,GAASC,IAChB,MAAMuL,EAAY,KACdhd,KAAKU,oBAAoB,OAAQsc,GACjCvL,GAAS,EAEbzR,KAAKE,iBAAiB,OAAQ8c,EAAU,IAEhD,CAEA,qBAAAtN,CAAsBlD,GAAe,CACrC,wBAAAuD,GAA6B,CAM7B,iBAAIkN,GAEA,OADArd,QAAQC,KAAK,4EACN,CACX,CAMA,iBAAIod,CAAcC,GACdtd,QAAQC,KAAK,2EACjB,CAMA,yBAAIsd,GAEA,OADAvd,QAAQC,KAAK,4FACN,CACX,CAMA,yBAAIsd,CAAsBD,GACtBtd,QAAQC,KAAK,2FACjB,CACA,2BAAO+U,CAAqBwI,EAAUvf,EAAM,IAAImE,EAAM8B,QAClD,MAAM6Q,EAAiB9W,EACjBwW,EAASM,EAAeN,OAC9BrR,EAAO6Q,YAEPuJ,EAASC,iBAAiBC,IACjBA,EAAOC,QAEZva,EAAOwa,eAAeF,EAAO,IAEjCta,EAAOsR,UAAUD,GAEjB,IAAIoJ,EAAc,EAelB,OAdAL,EAASC,iBAAiBC,IACtB,IAAKA,EAAOC,OACR,OACJ,MAAMG,EAAOJ,EACPK,EAAWD,EAAKC,SAAShT,QAC/BgT,EAASlB,aAAaiB,EAAKE,aAC3B,MACM9V,EADiB6V,EACSE,WAAW/V,SAC3C,IAAK,IAAIzG,EAAI,EAAGC,EAAIwG,EAASgW,MAAOzc,EAAIC,EAAGD,IACvCgB,EAAK0b,oBAAoBjW,EAAUzG,GACnCoc,EAAcriB,KAAKQ,IAAI6hB,EAAapJ,EAAO2J,kBAAkB3b,GACjE,IAEJsS,EAAejL,OAAStO,KAAKuD,KAAK8e,GAC3B9I,CACX","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});\nconst DOLLY_DIRECTION = {\n NONE: 0,\n IN: 1,\n OUT: -1,\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;\nconst DEG2RAD = Math.PI / 180;\nfunction clamp(value, min, max) {\n return Math.max(min, Math.min(max, value));\n}\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// https://docs.unity3d.com/ScriptReference/Mathf.SmoothDamp.html\n// https://github.com/Unity-Technologies/UnityCsReference/blob/a2bdfe9b3c4cd4476f44bf52f848063bfaf7b6b9/Runtime/Export/Math/Mathf.cs#L308\nfunction smoothDamp(current, target, currentVelocityRef, smoothTime, maxSpeed = Infinity, deltaTime) {\n // Based on Game Programming Gems 4 Chapter 1.10\n smoothTime = Math.max(0.0001, smoothTime);\n const omega = 2 / smoothTime;\n const x = omega * deltaTime;\n const exp = 1 / (1 + x + 0.48 * x * x + 0.235 * x * x * x);\n let change = current - target;\n const originalTo = target;\n // Clamp maximum speed\n const maxChange = maxSpeed * smoothTime;\n change = clamp(change, -maxChange, maxChange);\n target = current - change;\n const temp = (currentVelocityRef.value + omega * change) * deltaTime;\n currentVelocityRef.value = (currentVelocityRef.value - omega * temp) * exp;\n let output = target + (change + temp) * exp;\n // Prevent overshooting\n if (originalTo - current > 0.0 === output > originalTo) {\n output = originalTo;\n currentVelocityRef.value = (output - originalTo) / deltaTime;\n }\n return output;\n}\n// https://docs.unity3d.com/ScriptReference/Vector3.SmoothDamp.html\n// https://github.com/Unity-Technologies/UnityCsReference/blob/a2bdfe9b3c4cd4476f44bf52f848063bfaf7b6b9/Runtime/Export/Math/Vector3.cs#L97\nfunction smoothDampVec3(current, target, currentVelocityRef, smoothTime, maxSpeed = Infinity, deltaTime, out) {\n // Based on Game Programming Gems 4 Chapter 1.10\n smoothTime = Math.max(0.0001, smoothTime);\n const omega = 2 / smoothTime;\n const x = omega * deltaTime;\n const exp = 1 / (1 + x + 0.48 * x * x + 0.235 * x * x * x);\n let targetX = target.x;\n let targetY = target.y;\n let targetZ = target.z;\n let changeX = current.x - targetX;\n let changeY = current.y - targetY;\n let changeZ = current.z - targetZ;\n const originalToX = targetX;\n const originalToY = targetY;\n const originalToZ = targetZ;\n // Clamp maximum speed\n const maxChange = maxSpeed * smoothTime;\n const maxChangeSq = maxChange * maxChange;\n const magnitudeSq = changeX * changeX + changeY * changeY + changeZ * changeZ;\n if (magnitudeSq > maxChangeSq) {\n const magnitude = Math.sqrt(magnitudeSq);\n changeX = changeX / magnitude * maxChange;\n changeY = changeY / magnitude * maxChange;\n changeZ = changeZ / magnitude * maxChange;\n }\n targetX = current.x - changeX;\n targetY = current.y - changeY;\n targetZ = current.z - changeZ;\n const tempX = (currentVelocityRef.x + omega * changeX) * deltaTime;\n const tempY = (currentVelocityRef.y + omega * changeY) * deltaTime;\n const tempZ = (currentVelocityRef.z + omega * changeZ) * deltaTime;\n currentVelocityRef.x = (currentVelocityRef.x - omega * tempX) * exp;\n currentVelocityRef.y = (currentVelocityRef.y - omega * tempY) * exp;\n currentVelocityRef.z = (currentVelocityRef.z - omega * tempZ) * exp;\n out.x = targetX + (changeX + tempX) * exp;\n out.y = targetY + (changeY + tempY) * exp;\n out.z = targetZ + (changeZ + tempZ) * exp;\n // Prevent overshooting\n const origMinusCurrentX = originalToX - current.x;\n const origMinusCurrentY = originalToY - current.y;\n const origMinusCurrentZ = originalToZ - current.z;\n const outMinusOrigX = out.x - originalToX;\n const outMinusOrigY = out.y - originalToY;\n const outMinusOrigZ = out.z - originalToZ;\n if (origMinusCurrentX * outMinusOrigX + origMinusCurrentY * outMinusOrigY + origMinusCurrentZ * outMinusOrigZ > 0) {\n out.x = originalToX;\n out.y = originalToY;\n out.z = originalToZ;\n currentVelocityRef.x = (out.x - originalToX) / deltaTime;\n currentVelocityRef.y = (out.y - originalToY) / deltaTime;\n currentVelocityRef.z = (out.z - originalToZ) / deltaTime;\n }\n return out;\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\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 = '2.7.3'; // 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); // macOS 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 _cameraDirection;\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 * };\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 _cameraDirection = 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`. Default is `Number.EPSILON`.\n * PerspectiveCamera only.\n * @category Properties\n */\n this.minDistance = Number.EPSILON;\n /**\n * Maximum distance for dolly. The value must be higher than `minDistance`. Default is `Infinity`.\n * PerspectiveCamera only.\n * @category Properties\n */\n this.maxDistance = Infinity;\n /**\n * `true` to enable Infinity Dolly for wheel and pinch. Use this with `minDistance` and `maxDistance`\n * If the Dolly distance is less (or over) than the `minDistance` (or `maxDistance`), `infinityDolly` will keep the distance and pushes the target position instead.\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 * Approximate time in seconds to reach the target. A smaller value will reach the target faster.\n * @category Properties\n */\n this.smoothTime = 0.25;\n /**\n * the smoothTime while dragging\n * @category Properties\n */\n this.draggingSmoothTime = 0.125;\n /**\n * Max transition speed in unit-per-seconds\n * @category Properties\n */\n this.maxSpeed = Infinity;\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 * `true` to invert direction when dollying or zooming via drag\n * @category Properties\n */\n this.dollyDragInverted = false;\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._changedDolly = 0;\n this._changedZoom = 0;\n this._hasRested = true;\n this._boundaryEnclosesCamera = false;\n this._needsUpdate = true;\n this._updatedLastTime = false;\n this._elementRect = new DOMRect();\n this._isDragging = false;\n this._dragNeedsUpdate = true;\n this._activePointers = [];\n this._lockedPointer = null;\n this._interactiveArea = new DOMRect(0, 0, 1, 1);\n // Use draggingSmoothTime over smoothTime while true.\n // set automatically true on user-dragging start.\n // set automatically false on programmable methods call.\n this._isUserControllingRotate = false;\n this._isUserControllingDolly = false;\n this._isUserControllingTruck = false;\n this._isUserControllingOffset = false;\n this._isUserControllingZoom = false;\n this._lastDollyDirection = DOLLY_DIRECTION.NONE;\n // velocities for smoothDamp\n this._thetaVelocity = { value: 0 };\n this._phiVelocity = { value: 0 };\n this._radiusVelocity = { value: 0 };\n this._targetVelocity = new THREE.Vector3();\n this._focalOffsetVelocity = new THREE.Vector3();\n this._zoomVelocity = { value: 0 };\n this._truckInternal = (deltaX, deltaY, dragToOffset) => {\n let truckX;\n let pedestalY;\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() * DEG2RAD;\n const targetDistance = offset.length() * Math.tan(fov * 0.5);\n truckX = (this.truckSpeed * deltaX * targetDistance / this._elementRect.height);\n pedestalY = (this.truckSpeed * deltaY * targetDistance / this._elementRect.height);\n }\n else if (isOrthographicCamera(this._camera)) {\n const camera = this._camera;\n truckX = deltaX * (camera.right - camera.left) / camera.zoom / this._elementRect.width;\n pedestalY = deltaY * (camera.top - camera.bottom) / camera.zoom / this._elementRect.height;\n }\n else {\n return;\n }\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 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 lastDistance = this._sphericalEnd.radius;\n const distance = this._sphericalEnd.radius * dollyScale;\n const clampedDistance = clamp(distance, this.minDistance, this.maxDistance);\n const overflowedDistance = clampedDistance - distance;\n if (this.infinityDolly && this.dollyToCursor) {\n this._dollyToNoClamp(distance, true);\n }\n else if (this.infinityDolly && !this.dollyToCursor) {\n this.dollyInFixed(overflowedDistance, true);\n this._dollyToNoClamp(clampedDistance, true);\n }\n else {\n this._dollyToNoClamp(clampedDistance, true);\n }\n if (this.dollyToCursor) {\n this._changedDolly += (this.infinityDolly ? distance : clampedDistance) - lastDistance;\n this._dollyControlCoord.set(x, y);\n }\n this._lastDollyDirection = Math.sign(-delta);\n };\n this._zoomInternal = (delta, x, y) => {\n const zoomScale = Math.pow(0.95, delta * this.dollySpeed);\n const lastZoom = this._zoom;\n const zoom = this._zoom * zoomScale;\n // for both PerspectiveCamera and OrthographicCamera\n this.zoomTo(zoom, true);\n if (this.dollyToCursor) {\n this._changedZoom += zoom - lastZoom;\n this._dollyControlCoord.set(x, y);\n }\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 = this._yAxisUpSpace.clone().invert();\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._lastDistance = this._spherical.radius;\n this._zoom = this._camera.zoom;\n this._zoomEnd = this._zoom;\n this._lastZoom = 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._cameraUp0 = this._camera.up.clone();\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._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 if (this._interactiveArea.left !== 0 ||\n this._interactiveArea.top !== 0 ||\n this._interactiveArea.width !== 1 ||\n this._interactiveArea.height !== 1) {\n const elRect = this._domElement.getBoundingClientRect();\n const left = event.clientX / elRect.width;\n const top = event.clientY / elRect.height;\n // check if the interactiveArea contains the drag start position.\n if (left < this._interactiveArea.left ||\n left > this._interactiveArea.right ||\n top < this._interactiveArea.top ||\n top > this._interactiveArea.bottom)\n return;\n }\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 mouseButton = event.pointerType !== 'mouse' ? null :\n (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.LEFT :\n (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE ? MOUSE_BUTTON.MIDDLE :\n (event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT ? MOUSE_BUTTON.RIGHT :\n null;\n if (mouseButton !== null) {\n const zombiePointer = this._findPointerByMouseButton(mouseButton);\n zombiePointer && this._disposePointer(zombiePointer);\n }\n if ((event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT && this._lockedPointer)\n return;\n const pointer = {\n pointerId: event.pointerId,\n clientX: event.clientX,\n clientY: event.clientY,\n deltaX: 0,\n deltaY: 0,\n mouseButton,\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 this._isDragging = true;\n startDragging(event);\n };\n const onMouseDown = (event) => {\n if (!this._enabled || !this._domElement || this._lockedPointer)\n return;\n if (this._interactiveArea.left !== 0 ||\n this._interactiveArea.top !== 0 ||\n this._interactiveArea.width !== 1 ||\n this._interactiveArea.height !== 1) {\n const elRect = this._domElement.getBoundingClientRect();\n const left = event.clientX / elRect.width;\n const top = event.clientY / elRect.height;\n // check if the interactiveArea contains the drag start position.\n if (left < this._interactiveArea.left ||\n left > this._interactiveArea.right ||\n top < this._interactiveArea.top ||\n top > this._interactiveArea.bottom)\n return;\n }\n const mouseButton = (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.LEFT :\n (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE ? MOUSE_BUTTON.MIDDLE :\n (event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.RIGHT ? MOUSE_BUTTON.RIGHT :\n null;\n if (mouseButton !== null) {\n const zombiePointer = this._findPointerByMouseButton(mouseButton);\n zombiePointer && this._disposePointer(zombiePointer);\n }\n const pointer = {\n pointerId: 1,\n clientX: event.clientX,\n clientY: event.clientY,\n deltaX: 0,\n deltaY: 0,\n mouseButton: (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.LEFT :\n (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.MIDDLE :\n (event.buttons & MOUSE_BUTTON.RIGHT) === MOUSE_BUTTON.LEFT ? MOUSE_BUTTON.RIGHT :\n null,\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 this._isDragging = true;\n startDragging(event);\n };\n const onPointerMove = (event) => {\n if (event.cancelable)\n event.preventDefault();\n const pointerId = event.pointerId;\n const pointer = this._lockedPointer || 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 this._state = 0;\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 if ((!this._isDragging && this._lockedPointer) ||\n this._isDragging && (event.buttons & MOUSE_BUTTON.LEFT) === MOUSE_BUTTON.LEFT) {\n this._state = this._state | this.mouseButtons.left;\n }\n if (this._isDragging && (event.buttons & MOUSE_BUTTON.MIDDLE) === MOUSE_BUTTON.MIDDLE) {\n this._state = this._state | this.mouseButtons.middle;\n }\n if (this._isDragging && (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._lockedPointer || this._findPointerById(1);\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 (this._lockedPointer ||\n (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 onPointerUp = (event) => {\n const pointer = this._findPointerById(event.pointerId);\n if (pointer && pointer === this._lockedPointer)\n return;\n pointer && this._disposePointer(pointer);\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(1);\n if (pointer && pointer === this._lockedPointer)\n return;\n pointer && this._disposePointer(pointer);\n this._state = ACTION.NONE;\n endDragging();\n };\n let lastScrollTimeStamp = -1;\n const onMouseWheel = (event) => {\n if (!this._domElement)\n return;\n if (!this._enabled || this.mouseButtons.wheel === ACTION.NONE)\n return;\n if (this._interactiveArea.left !== 0 ||\n this._interactiveArea.top !== 0 ||\n this._interactiveArea.width !== 1 ||\n this._interactiveArea.height !== 1) {\n const elRect = this._domElement.getBoundingClientRect();\n const left = event.clientX / elRect.width;\n const top = event.clientY / elRect.height;\n // check if the interactiveArea contains the drag start position.\n if (left < this._interactiveArea.left ||\n left > this._interactiveArea.right ||\n top < this._interactiveArea.top ||\n top > this._interactiveArea.bottom)\n return;\n }\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 this._isUserControllingRotate = true;\n break;\n }\n case ACTION.TRUCK: {\n this._truckInternal(event.deltaX, event.deltaY, false);\n this._isUserControllingTruck = true;\n break;\n }\n case ACTION.OFFSET: {\n this._truckInternal(event.deltaX, event.deltaY, true);\n this._isUserControllingOffset = true;\n break;\n }\n case ACTION.DOLLY: {\n this._dollyInternal(-delta, x, y);\n this._isUserControllingDolly = true;\n break;\n }\n case ACTION.ZOOM: {\n this._zoomInternal(-delta, x, y);\n this._isUserControllingZoom = true;\n break;\n }\n }\n this.dispatchEvent({ type: 'control' });\n };\n const onContextMenu = (event) => {\n if (!this._domElement || !this._enabled)\n return;\n // contextmenu event is fired right after pointerdown/mousedown.\n // remove attached handlers and active pointer, if interrupted by contextmenu.\n if (this.mouseButtons.right === CameraControls.ACTION.NONE) {\n const pointerId = event instanceof PointerEvent ? event.pointerId :\n event instanceof MouseEvent ? 0 :\n 0;\n const pointer = this._findPointerById(pointerId);\n pointer && this._disposePointer(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.removeEventListener('mousemove', onMouseMove);\n this._domElement.ownerDocument.removeEventListener('mouseup', onMouseUp);\n return;\n }\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 this._state = 0;\n if (!event) {\n if (this._lockedPointer)\n this._state = this._state | this.mouseButtons.left;\n }\n else if ('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 if (!this._lockedPointer && (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 // stop current movement on drag start\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._sphericalEnd.theta = this._spherical.theta;\n this._sphericalEnd.phi = this._spherical.phi;\n this._thetaVelocity.value = 0;\n this._phiVelocity.value = 0;\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._targetEnd.copy(this._target);\n this._targetVelocity.set(0, 0, 0);\n }\n if ((this._state & ACTION.DOLLY) === ACTION.DOLLY ||\n (this._state & ACTION.TOUCH_DOLLY) === ACTION.TOUCH_DOLLY ||\n (this._state & ACTION.TOUCH_DOLLY_TRUCK) === ACTION.TOUCH_DOLLY_TRUCK ||\n (this._state & ACTION.TOUCH_DOLLY_OFFSET) === ACTION.TOUCH_DOLLY_OFFSET ||\n (this._state & ACTION.TOUCH_DOLLY_ROTATE) === ACTION.TOUCH_DOLLY_ROTATE) {\n this._sphericalEnd.radius = this._spherical.radius;\n this._radiusVelocity.value = 0;\n }\n if ((this._state & ACTION.ZOOM) === ACTION.ZOOM ||\n (this._state & ACTION.TOUCH_ZOOM) === ACTION.TOUCH_ZOOM ||\n (this._state & ACTION.TOUCH_ZOOM_TRUCK) === ACTION.TOUCH_ZOOM_TRUCK ||\n (this._state & ACTION.TOUCH_ZOOM_OFFSET) === ACTION.TOUCH_ZOOM_OFFSET ||\n (this._state & ACTION.TOUCH_ZOOM_ROTATE) === ACTION.TOUCH_ZOOM_ROTATE) {\n this._zoomEnd = this._zoom;\n this._zoomVelocity.value = 0;\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._focalOffsetEnd.copy(this._focalOffset);\n this._focalOffsetVelocity.set(0, 0, 0);\n }\n this.dispatchEvent({ type: 'controlstart' });\n };\n const dragging = () => {\n if (!this._enabled || !this._dragNeedsUpdate)\n return;\n this._dragNeedsUpdate = false;\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 lockedPointer = isPointerLockActive ? this._lockedPointer || this._activePointers[0] : null;\n const deltaX = lockedPointer ? -lockedPointer.deltaX : lastDragPosition.x - _v2.x;\n const deltaY = lockedPointer ? -lockedPointer.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 this._isUserControllingRotate = true;\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 const dollyDirection = this.dollyDragInverted ? -1 : 1;\n if ((this._state & ACTION.DOLLY) === ACTION.DOLLY) {\n this._dollyInternal(dollyDirection * deltaY * TOUCH_DOLLY_FACTOR, dollyX, dollyY);\n this._isUserControllingDolly = true;\n }\n else {\n this._zoomInternal(dollyDirection * deltaY * TOUCH_DOLLY_FACTOR, dollyX, dollyY);\n this._isUserControllingZoom = true;\n }\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 if ((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._isUserControllingDolly = true;\n }\n else {\n this._zoomInternal(dollyDelta * TOUCH_DOLLY_FACTOR, dollyX, dollyY);\n this._isUserControllingZoom = true;\n }\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 this._isUserControllingTruck = true;\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 this._isUserControllingOffset = true;\n }\n this.dispatchEvent({ type: 'control' });\n };\n const endDragging = () => {\n extractClientCoordFromEvent(this._activePointers, _v2);\n lastDragPosition.copy(_v2);\n this._dragNeedsUpdate = false;\n if (this._activePointers.length === 0 ||\n (this._activePointers.length === 1 && this._activePointers[0] === this._lockedPointer)) {\n this._isDragging = false;\n }\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('mousemove', onMouseMove);\n this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);\n this._domElement.ownerDocument.removeEventListener('mouseup', onMouseUp);\n this.dispatchEvent({ type: 'controlend' });\n }\n };\n this.lockPointer = () => {\n if (!this._enabled || !this._domElement)\n return;\n this.cancel();\n // Element.requestPointerLock is allowed to happen without any pointer active - create a faux one for compatibility with controls\n this._lockedPointer = {\n pointerId: -1,\n clientX: 0,\n clientY: 0,\n deltaX: 0,\n deltaY: 0,\n mouseButton: null,\n };\n this._activePointers.push(this._lockedPointer);\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.requestPointerLock();\n this._domElement.ownerDocument.addEventListener('pointerlockchange', onPointerLockChange);\n this._domElement.ownerDocument.addEventListener('pointerlockerror', onPointerLockError);\n this._domElement.ownerDocument.addEventListener('pointermove', onPointerMove, { passive: false });\n this._domElement.ownerDocument.addEventListener('pointerup', onPointerUp);\n startDragging();\n };\n this.unlockPointer = () => {\n if (this._lockedPointer !== null) {\n this._disposePointer(this._lockedPointer);\n this._lockedPointer = null;\n }\n document.exitPointerLock();\n this.cancel();\n if (!this._domElement)\n return;\n this._domElement.ownerDocument.removeEventListener('pointerlockchange', onPointerLockChange);\n this._domElement.ownerDocument.removeEventListener('pointerlockerror', onPointerLockError);\n };\n const onPointerLockChange = () => {\n const isPointerLockActive = this._domElement && this._domElement.ownerDocument.pointerLockElement === this._domElement;\n if (!isPointerLockActive)\n this.unlockPointer();\n };\n const onPointerLockError = () => {\n this.unlockPointer();\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 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.style.touchAction = '';\n this._domElement.style.userSelect = '';\n this._domElement.style.webkitUserSelect = '';\n this._domElement.removeEventListener('pointerdown', onPointerDown);\n this._domElement.removeEventListener('mousedown', onMouseDown);\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 this._domElement.ownerDocument.removeEventListener('pointerup', onPointerUp);\n this._domElement.ownerDocument.removeEventListener('mouseup', onMouseUp);\n this._domElement.ownerDocument.removeEventListener('pointerlockchange', onPointerLockChange);\n this._domElement.ownerDocument.removeEventListener('pointerlockerror', onPointerLockError);\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 this._enabled = enabled;\n if (!this._domElement)\n return;\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 * Set drag-start, touches and wheel enable area in the domElement.\n * each values are between `0` and `1` inclusive, where `0` is left/top and `1` is right/bottom of the screen.\n * e.g. `{ x: 0, y: 0, width: 1, height: 1 }` for entire area.\n * @category Properties\n */\n set interactiveArea(interactiveArea) {\n this._interactiveArea.width = clamp(interactiveArea.width, 0, 1);\n this._interactiveArea.height = clamp(interactiveArea.height, 0, 1);\n this._interactiveArea.x = clamp(interactiveArea.x, 0, 1 - this._interactiveArea.width);\n this._interactiveArea.y = clamp(interactiveArea.y, 0, 1 - this._interactiveArea.height);\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 this._isUserControllingRotate = false;\n const theta = clamp(azimuthAngle, this.minAzimuthAngle, this.maxAzimuthAngle);\n const phi = 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 this._isUserControllingDolly = false;\n this._lastDollyDirection = DOLLY_DIRECTION.NONE;\n this._changedDolly = 0;\n return this._dollyToNoClamp(clamp(distance, this.minDistance, this.maxDistance), enableTransition);\n }\n _dollyToNoClamp(distance, enableTransition = false) {\n const lastRadius = this._sphericalEnd.radius;\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 > distance;\n if (!isDollyIn && isCollided)\n return Promise.resolve();\n this._sphericalEnd.radius = Math.min(distance, maxDistanceByCollisionTest);\n }\n else {\n this._sphericalEnd.radius = distance;\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 * Dolly in, but does not change the distance between the target and the camera, and moves the target position instead.\n * Specify a negative value for dolly out.\n * @param distance Distance of dolly.\n * @param enableTransition Whether to move smoothly or immediately.\n * @category Methods\n */\n dollyInFixed(distance, enableTransition = false) {\n this._targetEnd.add(this._getCameraDirection(_cameraDirection).multiplyScalar(distance));\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 * 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._isUserControllingZoom = false;\n this._zoomEnd = 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 this._changedZoom = 0;\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 up / down.\n * @param height Amount to move up / down. Negative value to move down\n * @param enableTransition Whether to move smoothly or immediately\n * @category Methods\n */\n elevate(height, enableTransition = false) {\n _v3A.copy(this._camera.up).multiplyScalar(height);\n return this.moveTo(this._targetEnd.x + _v3A.x, this._targetEnd.y + _v3A.y, this._targetEnd.z + _v3A.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 this._isUserControllingTruck = 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 * Look in the given point direction.\n * @param x point x.\n * @param y point y.\n * @param z point z.\n * @param enableTransition Whether to move smoothly or immediately.\n * @returns Transition end promise\n * @category Methods\n */\n lookInDirectionOf(x, y, z, enableTransition = false) {\n const point = _v3A.set(x, y, z);\n const direction = point.sub(this._targetEnd).normalize();\n const position = direction.multiplyScalar(-this._sphericalEnd.radius);\n return this.setPosition(position.x, position.y, position.z, enableTransition);\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 CameraControls.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 * Look at the `target` from the `position`.\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 this._isUserControllingRotate = false;\n this._isUserControllingDolly = false;\n this._isUserControllingTruck = false;\n this._lastDollyDirection = DOLLY_DIRECTION.NONE;\n this._changedDolly = 0;\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 this._isUserControllingRotate = false;\n this._isUserControllingDolly = false;\n this._isUserControllingTruck = false;\n this._lastDollyDirection = DOLLY_DIRECTION.NONE;\n this._changedDolly = 0;\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 * Set angle and distance by given position.\n * An alias of `setLookAt()`, without target change. Thus 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 * Set the target position where gaze at.\n * An alias of `setLookAt()`, without position change. Thus keep the same 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 = clamp(this._sphericalEnd.phi, 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._isUserControllingOffset = false;\n this._focalOffsetEnd.set(x, y, z);\n this._needsUpdate = true;\n if (!enableTransition)\n this._focalOffset.copy(this._focalOffsetEnd);\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() * 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() * 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 the orbit center position, where the camera looking at.\n * @param out The receiving Vector3 instance to copy the result\n * @param receiveEndValue Whether receive the transition end coords or current. default is `true`\n * @category Methods\n */\n getTarget(out, receiveEndValue = true) {\n const _out = !!out && out.isVector3 ? out : new THREE.Vector3();\n return _out.copy(receiveEndValue ? this._targetEnd : this._target);\n }\n /**\n * Returns the camera position.\n * @param out The receiving Vector3 instance to copy the result\n * @param receiveEndValue Whether receive the transition end coords or current. default is `true`\n * @category Methods\n */\n getPosition(out, receiveEndValue = true) {\n const _out = !!out && out.isVector3 ? out : new THREE.Vector3();\n return _out.setFromSpherical(receiveEndValue ? this._sphericalEnd : this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(receiveEndValue ? this._targetEnd : this._target);\n }\n /**\n * Returns the spherical coordinates of the orbit.\n * @param out The receiving Spherical instance to copy the result\n * @param receiveEndValue Whether receive the transition end coords or current. default is `true`\n * @category Methods\n */\n getSpherical(out, receiveEndValue = true) {\n const _out = !!out && out instanceof THREE.Spherical ? out : new THREE.Spherical();\n return _out.copy(receiveEndValue ? this._sphericalEnd : this._spherical);\n }\n /**\n * Returns the focal offset, which is how much the camera appears to be translated in screen parallel coordinates.\n * @param out The receiving Vector3 instance to copy the result\n * @param receiveEndValue Whether receive the transition end coords or current. default is `true`\n * @category Methods\n */\n getFocalOffset(out, receiveEndValue = true) {\n const _out = !!out && out.isVector3 ? out : new THREE.Vector3();\n return _out.copy(receiveEndValue ? this._focalOffsetEnd : this._focalOffset);\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 if (!approxEquals(this._camera.up.x, this._cameraUp0.x) ||\n !approxEquals(this._camera.up.y, this._cameraUp0.y) ||\n !approxEquals(this._camera.up.z, this._cameraUp0.z)) {\n this._camera.up.copy(this._cameraUp0);\n const position = this.getPosition(_v3A);\n this.updateCameraUp();\n this.setPosition(position.x, position.y, position.z);\n }\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._cameraUp0.copy(this._camera.up);\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 this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert();\n }\n /**\n * Apply current camera-up direction to the camera.\n * The orbit system will be re-initialized with the current position.\n * @category Methods\n */\n applyCameraUp() {\n const cameraDirection = _v3A.subVectors(this._target, this._camera.position).normalize();\n // So first find the vector off to the side, orthogonal to both this.object.up and\n // the \"view\" vector.\n const side = _v3B.crossVectors(cameraDirection, this._camera.up);\n // Then find the vector orthogonal to both this \"side\" vector and the \"view\" vector.\n // This vector will be the new \"up\" vector.\n this._camera.up.crossVectors(side, cameraDirection).normalize();\n this._camera.updateMatrixWorld();\n const position = this.getPosition(_v3A);\n this.updateCameraUp();\n this.setPosition(position.x, position.y, position.z);\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 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 const deltaZoom = this._zoomEnd - this._zoom;\n // update theta\n if (approxZero(deltaTheta)) {\n this._thetaVelocity.value = 0;\n this._spherical.theta = this._sphericalEnd.theta;\n }\n else {\n const smoothTime = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;\n this._spherical.theta = smoothDamp(this._spherical.theta, this._sphericalEnd.theta, this._thetaVelocity, smoothTime, Infinity, delta);\n this._needsUpdate = true;\n }\n // update phi\n if (approxZero(deltaPhi)) {\n this._phiVelocity.value = 0;\n this._spherical.phi = this._sphericalEnd.phi;\n }\n else {\n const smoothTime = this._isUserControllingRotate ? this.draggingSmoothTime : this.smoothTime;\n this._spherical.phi = smoothDamp(this._spherical.phi, this._sphericalEnd.phi, this._phiVelocity, smoothTime, Infinity, delta);\n this._needsUpdate = true;\n }\n // update distance\n if (approxZero(deltaRadius)) {\n this._radiusVelocity.value = 0;\n this._spherical.radius = this._sphericalEnd.radius;\n }\n else {\n const smoothTime = this._isUserControllingDolly ? this.draggingSmoothTime : this.smoothTime;\n this._spherical.radius = smoothDamp(this._spherical.radius, this._sphericalEnd.radius, this._radiusVelocity, smoothTime, this.maxSpeed, delta);\n this._needsUpdate = true;\n }\n // update target position\n if (approxZero(deltaTarget.x) && approxZero(deltaTarget.y) && approxZero(deltaTarget.z)) {\n this._targetVelocity.set(0, 0, 0);\n this._target.copy(this._targetEnd);\n }\n else {\n const smoothTime = this._isUserControllingTruck ? this.draggingSmoothTime : this.smoothTime;\n smoothDampVec3(this._target, this._targetEnd, this._targetVelocity, smoothTime, this.maxSpeed, delta, this._target);\n this._needsUpdate = true;\n }\n // update focalOffset\n if (approxZero(deltaOffset.x) && approxZero(deltaOffset.y) && approxZero(deltaOffset.z)) {\n this._focalOffsetVelocity.set(0, 0, 0);\n this._focalOffset.copy(this._focalOffsetEnd);\n }\n else {\n const smoothTime = this._isUserControllingOffset ? this.draggingSmoothTime : this.smoothTime;\n smoothDampVec3(this._focalOffset, this._focalOffsetEnd, this._focalOffsetVelocity, smoothTime, this.maxSpeed, delta, this._focalOffset);\n this._needsUpdate = true;\n }\n // update zoom\n if (approxZero(deltaZoom)) {\n this._zoomVelocity.value = 0;\n this._zoom = this._zoomEnd;\n }\n else {\n const smoothTime = this._isUserControllingZoom ? this.draggingSmoothTime : this.smoothTime;\n this._zoom = smoothDamp(this._zoom, this._zoomEnd, this._zoomVelocity, smoothTime, Infinity, delta);\n }\n if (this.dollyToCursor) {\n if (isPerspectiveCamera(this._camera) && this._changedDolly !== 0) {\n const dollyControlAmount = this._spherical.radius - this._lastDistance;\n const camera = this._camera;\n const cameraDirection = this._getCameraDirection(_cameraDirection);\n const planeX = _v3A.copy(cameraDirection).cross(camera.up).normalize();\n if (planeX.lengthSq() === 0)\n planeX.x = 1.0;\n const planeY = _v3B.crossVectors(planeX, cameraDirection);\n const worldToScreen = this._sphericalEnd.radius * Math.tan(camera.getEffectiveFOV() * DEG2RAD * 0.5);\n const prevRadius = this._sphericalEnd.radius - dollyControlAmount;\n const lerpRatio = (prevRadius - this._sphericalEnd.radius) / this._sphericalEnd.radius;\n const cursor = _v3C.copy(this._targetEnd)\n .add(planeX.multiplyScalar(this._dollyControlCoord.x * worldToScreen * camera.aspect))\n .add(planeY.multiplyScalar(this._dollyControlCoord.y * worldToScreen));\n const newTargetEnd = _v3A.copy(this._targetEnd).lerp(cursor, lerpRatio);\n const isMin = this._lastDollyDirection === DOLLY_DIRECTION.IN && this._spherical.radius <= this.minDistance;\n const isMax = this._lastDollyDirection === DOLLY_DIRECTION.OUT && this.maxDistance <= this._spherical.radius;\n if (this.infinityDolly && (isMin || isMax)) {\n this._sphericalEnd.radius -= dollyControlAmount;\n this._spherical.radius -= dollyControlAmount;\n const dollyAmount = _v3B.copy(cameraDirection).multiplyScalar(-dollyControlAmount);\n newTargetEnd.add(dollyAmount);\n }\n // target position may be moved beyond boundary.\n this._boundary.clampPoint(newTargetEnd, newTargetEnd);\n const targetEndDiff = _v3B.subVectors(newTargetEnd, this._targetEnd);\n this._targetEnd.copy(newTargetEnd);\n this._target.add(targetEndDiff);\n this._changedDolly -= dollyControlAmount;\n if (approxZero(this._changedDolly))\n this._changedDolly = 0;\n }\n else if (isOrthographicCamera(this._camera) && this._changedZoom !== 0) {\n const dollyControlAmount = this._zoom - this._lastZoom;\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);\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 - dollyControlAmount;\n const lerpRatio = -(prevZoom - this._zoom) / 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 = this._getCameraDirection(_cameraDirection);\n const prevPlaneConstant = this._targetEnd.dot(cameraDirection);\n const newTargetEnd = _v3A.copy(this._targetEnd).lerp(cursor, lerpRatio);\n const newPlaneConstant = newTargetEnd.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 newTargetEnd.sub(pullBack);\n // target position may be moved beyond boundary.\n this._boundary.clampPoint(newTargetEnd, newTargetEnd);\n const targetEndDiff = _v3B.subVectors(newTargetEnd, this._targetEnd);\n this._targetEnd.copy(newTargetEnd);\n this._target.add(targetEndDiff);\n // this._target.copy( this._targetEnd );\n this._changedZoom -= dollyControlAmount;\n if (approxZero(this._changedZoom))\n this._changedZoom = 0;\n }\n }\n if (this._camera.zoom !== this._zoom) {\n this._camera.zoom = this._zoom;\n this._camera.updateProjectionMatrix();\n this._updateNearPlaneCorners();\n this._needsUpdate = true;\n }\n this._dragNeedsUpdate = true;\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 const affectOffset = !approxZero(this._focalOffset.x) ||\n !approxZero(this._focalOffset.y) ||\n !approxZero(this._focalOffset.z);\n if (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._lastDistance = this._spherical.radius;\n this._lastZoom = this._zoom;\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 smoothTime: this.smoothTime,\n draggingSmoothTime: this.draggingSmoothTime,\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 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.smoothTime = obj.smoothTime;\n this.draggingSmoothTime = obj.draggingSmoothTime;\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(_v3A.fromArray(obj.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace));\n this.rotateTo(_sphericalA.theta, _sphericalA.phi, enableTransition);\n this.dollyTo(_sphericalA.radius, 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 this._getClientRect(this._elementRect);\n }\n /**\n * Detach all internal event handlers to disable drag control.\n */\n disconnect() {\n this.cancel();\n this._removeAllEventListeners();\n if (this._domElement) {\n this._domElement.removeAttribute('data-camera-controls-version');\n this._domElement = undefined;\n }\n }\n /**\n * Dispose the cameraControls instance itself, remove all eventListeners.\n * @category Methods\n */\n dispose() {\n // remove all user event listeners\n this.removeAllEventListeners();\n // remove all internal event listeners\n this.disconnect();\n }\n // it's okay to expose public though\n _getTargetDirection(out) {\n // divide by distance to normalize, lighter than `Vector3.prototype.normalize()`\n return out.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse);\n }\n // it's okay to expose public though\n _getCameraDirection(out) {\n return this._getTargetDirection(out).negate();\n }\n _findPointerById(pointerId) {\n return this._activePointers.find((activePointer) => activePointer.pointerId === pointerId);\n }\n _findPointerByMouseButton(mouseButton) {\n return this._activePointers.find((activePointer) => activePointer.mouseButton === mouseButton);\n }\n _disposePointer(pointer) {\n this._activePointers.splice(this._activePointers.indexOf(pointer), 1);\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() * 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 const rayDirection = this._getTargetDirection(_cameraDirection);\n _rotationMatrix.lookAt(_ORIGIN, rayDirection, 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, rayDirection);\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 /**\n * backward compatible\n * @deprecated use smoothTime (in seconds) instead\n * @category Properties\n */\n get dampingFactor() {\n console.warn('.dampingFactor has been deprecated. use smoothTime (in seconds) instead.');\n return 0;\n }\n /**\n * backward compatible\n * @deprecated use smoothTime (in seconds) instead\n * @category Properties\n */\n set dampingFactor(_) {\n console.warn('.dampingFactor has been deprecated. use smoothTime (in seconds) instead.');\n }\n /**\n * backward compatible\n * @deprecated use draggingSmoothTime (in seconds) instead\n * @category Properties\n */\n get draggingDampingFactor() {\n console.warn('.draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.');\n return 0;\n }\n /**\n * backward compatible\n * @deprecated use draggingSmoothTime (in seconds) instead\n * @category Properties\n */\n set draggingDampingFactor(_) {\n console.warn('.draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.');\n }\n static createBoundingSphere(object3d, out = new THREE.Sphere()) {\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 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 boundingSphere.radius = Math.sqrt(maxRadiusSq);\n return boundingSphere;\n }\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","DEG2RAD","clamp","value","min","max","approxZero","number","error","abs","approxEquals","a","b","roundToStep","step","round","infinityToMaxNumber","isFinite","Number","MAX_VALUE","maxNumberToInfinity","Infinity","smoothDamp","current","target","currentVelocityRef","smoothTime","maxSpeed","deltaTime","omega","x","exp","change","originalTo","maxChange","temp","output","smoothDampVec3","out","targetX","targetY","y","targetZ","z","changeX","changeY","changeZ","originalToX","originalToY","originalToZ","magnitudeSq","magnitude","sqrt","tempX","tempY","tempZ","origMinusCurrentX","origMinusCurrentY","origMinusCurrentZ","extractClientCoordFromEvent","pointers","set","forEach","pointer","clientX","clientY","length","notSupportedInOrthographicCamera","message","console","warn","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","_cameraDirection","_xColumn","_yColumn","_zColumn","_deltaTarget","_deltaOffset","_sphericalA","_sphericalB","_box3A","_box3B","_sphere","_quaternionA","_quaternionB","_rotationMatrix","_raycaster","CameraControls","install","libs","Vector3","Vector2","Spherical","Box3","Sphere","Quaternion","Matrix4","Raycaster","domElement","super","minPolarAngle","maxPolarAngle","minAzimuthAngle","maxAzimuthAngle","minDistance","maxDistance","infinityDolly","minZoom","maxZoom","draggingSmoothTime","azimuthRotateSpeed","polarRotateSpeed","dollySpeed","dollyDragInverted","truckSpeed","dollyToCursor","dragToOffset","verticalDragToForward","boundaryFriction","restThreshold","colliderMeshes","cancel","_enabled","_state","_viewport","_changedDolly","_changedZoom","_hasRested","_boundaryEnclosesCamera","_needsUpdate","_updatedLastTime","_elementRect","DOMRect","_isDragging","_dragNeedsUpdate","_activePointers","_lockedPointer","_interactiveArea","_isUserControllingRotate","_isUserControllingDolly","_isUserControllingTruck","_isUserControllingOffset","_isUserControllingZoom","_lastDollyDirection","_thetaVelocity","_phiVelocity","_radiusVelocity","_targetVelocity","_focalOffsetVelocity","_zoomVelocity","_truckInternal","deltaX","deltaY","truckX","pedestalY","_camera","offset","copy","position","sub","_target","fov","getEffectiveFOV","targetDistance","tan","height","right","left","zoom","width","top","bottom","setFocalOffset","_focalOffsetEnd","truck","forward","_rotateInternal","theta","phi","rotate","_dollyInternal","delta","dollyScale","pow","lastDistance","_sphericalEnd","radius","distance","clampedDistance","overflowedDistance","_dollyToNoClamp","dollyInFixed","_dollyControlCoord","sign","_zoomInternal","zoomScale","lastZoom","_zoom","zoomTo","_yAxisUpSpace","setFromUnitVectors","up","_yAxisUpSpaceInverse","clone","invert","_targetEnd","_focalOffset","_spherical","setFromVector3","applyQuaternion","_lastDistance","_zoomEnd","_lastZoom","_nearPlaneCorners","_updateNearPlaneCorners","_boundary","_cameraUp0","_target0","_position0","_zoom0","_focalOffset0","mouseButtons","middle","wheel","touches","one","two","three","dragStartPosition","lastDragPosition","dollyStart","onPointerDown","_domElement","elRect","getBoundingClientRect","mouseButton","pointerType","buttons","zombiePointer","_findPointerByMouseButton","_disposePointer","pointerId","ownerDocument","onPointerMove","passive","onPointerUp","startDragging","onMouseDown","onMouseMove","onMouseUp","cancelable","preventDefault","_findPointerById","movementX","movementY","dragging","endDragging","lastScrollTimeStamp","onMouseWheel","now","performance","_getClientRect","deltaYFactor","deltaMode","onContextMenu","PointerEvent","MouseEvent","dx","dy","lockedPointer","document","pointerLockElement","dollyX","dollyY","dollyDirection","dollyDelta","lockPointer","requestPointerLock","onPointerLockChange","onPointerLockError","unlockPointer","exitPointerLock","_addAllEventListeners","style","touchAction","userSelect","webkitUserSelect","_removeAllEventListeners","connect","update","updateCameraUp","updateProjectionMatrix","enabled","active","currentAction","azimuthAngle","polarAngle","boundaryEnclosesCamera","interactiveArea","enableTransition","rotateTo","rotateAzimuthTo","rotatePolarTo","makeSafe","resolveImmediately","_createOnRestPromise","dolly","dollyTo","lastRadius","maxDistanceByCollisionTest","_collisionTest","isCollided","Promise","resolve","add","_getCameraDirection","multiplyScalar","zoomStep","pan","updateMatrix","setFromMatrixColumn","matrix","to","moveTo","crossVectors","elevate","_encloseToBoundary","lookInDirectionOf","normalize","setPosition","fitToBox","box3OrObject","cover","paddingLeft","paddingRight","paddingBottom","paddingTop","promises","aabb","isBox3","setFromObject","isEmpty","normal","setFromSpherical","rotation","viewFromPolar","multiply","setFromAxisAngle","bb","makeEmpty","expandByPoint","setX","setY","setZ","premultiply","bbSize","getSize","center","getCenter","getDistanceToFitBox","all","fitToSphere","sphereOrMesh","boundingSphere","createBoundingSphere","distanceToFit","getDistanceToFitSphere","diameter","setLookAt","positionX","positionY","positionZ","normalizeRotations","lerpLookAt","positionAX","positionAY","positionAZ","targetAX","targetAY","targetAZ","positionBX","positionBY","positionBZ","targetBX","targetBY","targetBZ","t","targetA","positionA","targetB","positionB","lerp","deltaTheta","deltaPhi","deltaRadius","setTarget","pos","getPosition","promise","setOrbitPoint","updateMatrixWorld","matrixWorldInverse","distanceTo","cameraToPoint","setBoundary","box3","clampPoint","setViewport","viewportOrX","Vector4","depth","boundingRectAspect","aspect","vFOV","hFOV","atan","sin","getTarget","receiveEndValue","isVector3","getSpherical","getFocalOffset","reset","saveState","applyCameraUp","cameraDirection","subVectors","side","deltaTarget","deltaOffset","deltaZoom","dollyControlAmount","planeX","cross","lengthSq","planeY","worldToScreen","lerpRatio","cursor","newTargetEnd","isMin","isMax","dollyAmount","targetEndDiff","worldCursorPosition","near","far","unproject","quaternion","dot","prevPlaneConstant","newPlaneConstant","pullBack","lookAt","updated","toJSON","JSON","stringify","toArray","focalOffset","target0","position0","zoom0","focalOffset0","fromJSON","json","obj","parse","fromArray","setAttribute","disconnect","removeAttribute","dispose","_getTargetDirection","divideScalar","negate","find","activePointer","friction","offsetLength2","newTarget","deltaClampedTarget","deltaClampedTargetLength2","offsetFactor","heightHalf","widthHalf","zoomInv","rayDirection","nearPlaneCorner","applyMatrix4","origin","addVectors","intersects","intersectObjects","rect","w","onResolve","dampingFactor","_","draggingDampingFactor","object3d","traverseVisible","object","isMesh","expandByObject","maxRadiusSq","mesh","geometry","matrixWorld","attributes","count","fromBufferAttribute","distanceToSquared"],"sourceRoot":""}