import { Box3, PerspectiveCamera, Vector3 } from 'three'; import { ComboControlsOptions } from './ComboControlsOptions'; import { CameraState, CameraManagerEventType, CameraEventDelegate } from './types'; import { CameraManager } from './CameraManager'; import { CameraControlsOptions } from './CameraControlsOptions'; /** * Default implementation of {@link CameraManager}. Uses target-based orbit controls combined with * keyboard and mouse navigation possibility. Supports automatic update of camera near and far * planes and animated change of camera position and target. */ export declare class DefaultCameraManager implements CameraManager { private readonly _events; private readonly _stopEventTrigger; private readonly _controls; private readonly _camera; private readonly _domElement; private readonly _inputHandler; private readonly _raycaster; private _isDisposed; private _nearAndFarNeedsUpdate; private readonly cameraManagerHelper; private _isEnabled; private readonly _raycastCallback; private _onClick; private _onDoubleClick; private _onWheel; private static readonly AnimationDuration; private static readonly MinAnimationDuration; private static readonly MaxAnimationDuration; private static readonly MinDistance; private static readonly MinZoomDistance; private static readonly MinimalTimeBetweenRaycasts; private static readonly MaximumTimeBetweenRaycasts; private static readonly MouseDistanceThresholdBetweenRaycasts; private static readonly DefaultCameraControlsOptions; private _cameraControlsOptions; private readonly _currentBoundingBox; /** * When false, camera near and far planes will not be updated automatically (defaults to true). * This can be useful when you have custom content in the 3D view and need to better * control the view frustum. * * When automatic camera near/far planes are disabled, you are responsible for setting * this on your own. * @example * ``` * viewer.camera.near = 0.1; * viewer.camera.far = 1000.0; * viewer.camera.updateProjectionMatrix(); * ``` */ automaticNearFarPlane: boolean; /** * When false, the sensitivity of the camera controls will not be updated automatically. * This can be useful to better control the sensitivity of the 3D navigation. * * When not set, control the sensitivity of the camera using `viewer.cameraManager.cameraControls.minDistance` * and `viewer.cameraManager.cameraControls.maxDistance`. */ automaticControlsSensitivity: boolean; on(event: CameraManagerEventType, callback: CameraEventDelegate): void; off(event: CameraManagerEventType, callback: CameraEventDelegate): void; fitCameraToBoundingBox(box: Box3, duration?: number, radiusFactor?: number): void; /** * Gets current Combo Controls options. */ getComboControlsOptions(): Readonly; /** * Sets Combo Controls options. * Only provided options will be changed, any undefined options will be kept as is. */ setComboControlsOptions(options: Partial): void; /** * Sets whether keyboard control of the camera is enabled/disabled. */ set keyboardNavigationEnabled(enabled: boolean); /** * Whether keyboard control of the camera is enabled/disabled. */ get keyboardNavigationEnabled(): boolean; getCamera(): PerspectiveCamera; /** * Sets camera state. All parameters are optional. Rotation and target can't be set at the same time, * if so, error will be thrown. Set rotation is preserved until next call of setCameraState with * empty rotation field. * @param state Camera state. * **/ setCameraState(state: CameraState): void; getCameraState(): Required; activate(cameraManager?: CameraManager): void; deactivate(): void; /** * Gets current camera controls options. */ getCameraControlsOptions(): CameraControlsOptions; /** * Sets camera controls options to customize camera controls modes. See {@link CameraControlsOptions}. * @param controlsOptions JSON object with camera controls options. */ setCameraControlsOptions(controlsOptions: CameraControlsOptions): void; update(deltaTime: number, boundingBox: Box3): void; dispose(): void; /** * Animates the camera to the given position and target. * @param position Desired camera position in world space. * @param target Desired look-at target in world space. * @param duration Duration of the animation in milliseconds. If omitted, a default is derived from distance. */ moveCameraTo(position: Vector3, target: Vector3, duration?: number, keyboardNavigationEnabled?: boolean): void; private moveCameraTargetTo; private updateCameraNearAndFar; private calculateAnimationStartTarget; private createTweenAnimation; /** * Calculates new target when raycaster doesn't have any intersections with the model. * @param cursorPosition Cursor position for desired calculations. * @param cursorPosition.x * @param cursorPosition.y */ private calculateNewTargetWithoutModel; /** * Calculates new camera target based on cursor position. * @param event PointerEvent that contains pointer location data. */ private calculateNewTarget; /** * Removes controls event listeners if they are defined. */ private teardownControls; private handleMouseWheelActionChange; /** * Method for setting up camera controls listeners and values inside current controls class. */ private setupControls; private readonly onClick; private readonly onDoubleClick; private calculateDefaultDuration; } /** * type guard which determines if the provided camera manager is a @see { DefaultCameraManager } */ export declare function isDefaultCameraManager(cameraManager: CameraManager): cameraManager is DefaultCameraManager;