Options
All
  • Public
  • Public/Protected
  • All
Menu

Allows a camera to be manipulated using mouse controls.

// The trackball controls a view implementation such as a camera.
const camera = new EIGHT.PerspectiveCamera()

// Create TrackballControls anytime.
const controls = new EIGHT.TrackballControls(camera)

// Subscribe to mouse events, usually in the window.onload function.
controls.subscribe(canvas)

// Update the camera position, usually in the animate function.
controls.update()

// Stop listening to mouse events.
controls.unsubscribe()

// Inform the controls they are no longer needed, usually in the window.onunload function.
controls.release()

You may decide to update directional lighting to synchronize with the camera.

Hierarchy

  • ViewControls
    • TrackballControls

Implements

Index

Constructors

constructor

  • new TrackballControls(view: { eye: VectorE3; look: VectorE3; up: VectorE3 }, wnd?: BrowserWindow): TrackballControls
  • Parameters

    • view: { eye: VectorE3; look: VectorE3; up: VectorE3 }

      eye, look, and up vectors. The coordinates will be manipulated by this object.

      • eye: VectorE3
      • look: VectorE3
      • up: VectorE3
    • Default value wnd: BrowserWindow = window

      The browser window. Used to add listeners for mouse and keyboard events.

    Returns TrackballControls

Properties

enabled

enabled: boolean = true
default

true

Protected eyeMinusLook

eyeMinusLook: Vector3 = new Vector3()

Protected look

look: Vector3 = new Vector3()

maxDistance

maxDistance: number = Infinity
default

Infinity

minDistance

minDistance: number = 0
default

0

Protected moveCurr

moveCurr: Vector2 = new Vector2()

Protected movePrev

movePrev: Vector2 = new Vector2()

noPan

noPan: boolean = false
default

false

noRotate

noRotate: boolean = false
default

false

noZoom

noZoom: boolean = false
default

false

Protected panEnd

panEnd: Vector2 = new Vector2()

panSpeed

panSpeed: number = 1
default

1

Protected panStart

panStart: Vector2 = new Vector2()

rotateSpeed

rotateSpeed: number = 1
default

1

Protected up

up: Vector3 = new Vector3()

Protected zoomEnd

zoomEnd: Vector2 = new Vector2()

zoomSpeed

zoomSpeed: number = 1
default

1

Protected zoomStart

zoomStart: Vector2 = new Vector2()

Methods

addRef

  • addRef(): number

disableContextMenu

  • disableContextMenu(): void

enableContextMenu

  • enableContextMenu(): void

getLoggingName

  • getLoggingName(): string
  • Returns the name that was assigned by the call to the setLoggingName method.

    Returns string

handleResize

  • handleResize(): void

Protected hasView

  • hasView(): boolean

isZombie

  • isZombie(): boolean
  • An object is a zombie if it has been released by all who have held references. In some cases it may be possible to recycle a zombie.

    Returns boolean

move

  • move(x: number, y: number): void
  • Simulates a movement of the mouse in coordinates -1 to +1 in both directions.

    Parameters

    • x: number
    • y: number

    Returns void

release

  • release(): number

reset

  • reset(): void

Protected setLoggingName

  • setLoggingName(name: string): void
  • This method is for use within constructors.

    Immediately after a call to the super class constructor, make a call to setLoggingName. This will have the effect of refining the name used for reporting reference counts.

    This method has the secondary purpose of enabling a tally of the number of classes in the constructor chain. This enables the runtime architecture to verify that destructor chains are consistent with constructor chains, which is a good practice for cleaning up resources.

    Notice that this method is intentionally protected to discourage it from being called outside of the constructor.

    Parameters

    • name: string

      This will usually be set to the name of the class.

    Returns void

setView

  • setView(view: { eye: VectorE3; look: VectorE3; up: VectorE3 }): void
  • Parameters

    • view: { eye: VectorE3; look: VectorE3; up: VectorE3 }
      • eye: VectorE3
      • look: VectorE3
      • up: VectorE3

    Returns void

subscribe

  • subscribe(domElement: HTMLElement): void

synchronize

  • synchronize(): void

unsubscribe

  • unsubscribe(): void

update

  • update(): void
  • This should be called inside the animation frame to update the camera location. Notice that the movement of the mouse controls is decoupled from the effect. We also want to avoid temporary object creation in this and called methods by recycling variables.

    Returns void

Protected zoomCamera

  • zoomCamera(): void

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Protected property
  • Protected method
  • Static property
  • Static method

Generated using TypeDoc