Class OrbitControl

Orbital controls for zooming around a center point.

Hierarchy

  • OrbitControl

Constructors

Properties

STATE: { NONE: number; PAN: number; ROTATE: number; ZOOM: number }

What state is the current controller in.

Type declaration

  • NONE: number
  • PAN: number
  • ROTATE: number
  • ZOOM: number
_isMouseUp: boolean
_offset: Vector3
_panDelta: Vector2
_panEnd: Vector2
_panOffset: Vector3
_panStart: Vector2
_position: Vector3
_rotateDelta: Vector2
_rotateEnd: Vector2
_rotateStart: Vector2
_scale: number
_spherical: Spherical
_sphericalDelta: Spherical
_sphericalDump: Spherical
_state: any
_vPan: Vector3
_zoomDelta: Vector2
_zoomEnd: Vector2
_zoomFrag: number
_zoomStart: Vector2
autoRotate: boolean

Whether to auto rotate.

autoRotateSpeed: number = Math.PI

Auto rotate speed.

camera: Camera

Camera instance, the essence of orbit control is to change the camera position.

constEvents: { element?: Window; listener: any; type: string }[]

Contains mousedown and wheel.

dampingFactor: number

Damping factor

domElement: HTMLElement | Document

DOM element, mainly used to listen for mouse up events.

enableDamping: boolean

Whether to enable damping.

enablePan: boolean

Whether to enable pan.

enableRotate: boolean

Whether to enable rotate.

enableZoom: boolean

Whether to enable zoom.

fov: number

Camera frustum angle.

mainElement: HTMLCanvasElement

Canvas element, mainly used to monitor mouse movement events.

maxAzimuthAngle: number

Max azimuth angle.

maxDistance: number

The maximum distance from the camera to the object.

maxPolarAngle: number

Max polar angle.

maxZoom: number

The maximum zoom scale of the camera.

minAzimuthAngle: number

Min azimuth angle.

minDistance: number

The minimum distance from the camera to the object.

minPolarAngle: number

Min polar angle.

minZoom: number

The smallest zoom scale of the camera.

mouseButtons: { ORBIT: number; PAN: number; ZOOM: number }

Clicking the corresponding key with the mouse is actually the key corresponding to the left button, the scroll wheel and the right button.

Type declaration

  • ORBIT: number
  • PAN: number
  • ZOOM: number
mouseUpEvents: { listener: any; type: string }[]

Contains mousemove and mouseup.

rotateSpeed: number

Rotate speed.

target: Vector3

Where the camera is looking.

Camera up.

zoomFactor: number

Scaling factor.

zoomSpeed: number

Zoom speed

Methods

  • Get auto rotation angle.

    Returns

    Auto rotate speed.

    Parameters

    • dtime: number

      Rendering the time difference between the current frame and the previous frame.

    Returns number

  • Set pan start when state is pan.

    Parameters

    • event: MouseEvent

      Mouse event.

    Returns void

  • Set rotate start when state is rotate.

    Parameters

    • event: MouseEvent

      Mouse event.

    Returns void

  • Set zoom start when state is zoom.

    Parameters

    • event: MouseEvent

      Mouse event.

    Returns void

  • Calculate the pan difference when the mouse is moved.

    Parameters

    • event: MouseEvent

      Mouse event.

    Returns void

  • Calculate the rotation difference when the mouse is moved.

    Parameters

    • event: MouseEvent

      Mouse event.

    Returns void

  • Calculate the rotation difference when the mouse is moved.

    Parameters

    • event: MouseEvent

      Mouse event.

    Returns void

  • Calculate the wheel difference when the mouse is moved.

    Parameters

    • event: any

      Mouse event.

    Returns void

  • The life cycle of track control destruction, used to remove listener events.

    Returns void

  • Listen to the mouse click event, and set the context state to the mouse click type according to the click type, and then select the corresponding processing method

    Parameters

    • event: MouseEvent

      Mouse event.

    Returns void

  • Monitor mouse movement events, select the corresponding movement processing method for the current context state.

    Parameters

    • event: MouseEvent

      Mouse event.

    Returns void

  • Listen for the mouse up event, remove the corresponding listener event and set the context state to none.

    Returns void

  • Listen to the mouse wheel event, prevent the default behavior, and scale according to the current event event information.

    Parameters

    • event: any

      Mouse wheel event.

    Returns void

  • The orbit controls the life cycle, updating the view based on the current mouse changes.

    Parameters

    • dtime: number

      Used to calculate how many degrees to rotate.

    Returns void

  • Pan according to panLeft and panUp.

    Parameters

    • deltaX: number

      The difference between the mouse and the x-direction of the previous view.

    • deltaY: number

      The difference between the mouse and the y-direction of the previous view

    Returns void

  • Handle left and right translation.

    Parameters

    • distance: number

      Camera translation distance.

    • worldMatrix: Matrix4

      Camera's world coordinate matrix.

    Returns void

  • Handle up and down translation.

    Parameters

    • distance: number

      Camera translation distance.

    • worldMatrix: Matrix4

      Camera's world coordinate matrix.

    Returns void

  • Rotate left and right.

    Parameters

    • radian: number

      Rotation angle, radian system.

    Returns void

  • Rotate up and down.

    Parameters

    • radian: number

      Rotation angle, radian system.

    Returns void

  • Zoom in view.

    Parameters

    • zoomScale: number

      Zoom scale.

    Returns void

  • Zoom out view.

    Parameters

    • zoomScale: number

      Zoom scale.

    Returns void

Generated using TypeDoc