NGL@1.0.0-beta.7 Home Manual Reference Source Gallery
import ViewerControls from 'ngl/src/controls/viewer-controls.js'
public class | source

ViewerControls

Viewer controls

Constructor Summary

Public Constructor
public

constructor(stage: Stage)

Member Summary

Public Members
public get

scene center position

public get

scene rotation

public

signals: {changed: Signal}

public
public

Method Summary

Public Methods
public

align scene to basis matrix

public

apply rotation matrix to scene

public

center(position: Vector3 | Array): undefined

center scene

public

Trigger render and emit changed event

public

camera distance

public

get scene orientation

public
public

set scene orientation

public

rotate(quaternion: Quaternion | Array): undefined

rotate scene

public

spin(axis: Vector3 | Array, angle: Number): undefined

spin scene on axis

public

translate scene

public

zoom(delta: Number): undefined

zoom scene

Public Constructors

public constructor(stage: Stage) source

Params:

NameTypeAttributeDescription
stage Stage

the stage object

Public Members

public get position: Vector3 source

scene center position

public get rotation: Quaternion source

scene rotation

public signals: {changed: Signal} source

public stage source

public viewer source

Public Methods

public align(basis: Matrix4 | Array): undefined source

align scene to basis matrix

Params:

NameTypeAttributeDescription
basis Matrix4 | Array

basis matrix

Return:

undefined

public applyMatrix(matrix: Matrix4 | Array): undefined source

apply rotation matrix to scene

Params:

NameTypeAttributeDescription
matrix Matrix4 | Array

rotation matrix

Return:

undefined

public center(position: Vector3 | Array): undefined source

center scene

Params:

NameTypeAttributeDescription
position Vector3 | Array

center position

Return:

undefined

public changed(): undefined source

Trigger render and emit changed event

Return:

undefined

Emit:

ViewerControls.signals.changed

public distance(z: Number): undefined source

camera distance

Params:

NameTypeAttributeDescription
z Number

distance

Return:

undefined

public getOrientation(optionalTarget: Matrix4): OrientationMatrix source

get scene orientation

Params:

NameTypeAttributeDescription
optionalTarget Matrix4

pre-allocated target matrix

Return:

OrientationMatrix

scene orientation

public getPositionOnCanvas() source

public orient(orientation: OrientationMatrix | Array): undefined source

set scene orientation

Params:

NameTypeAttributeDescription
orientation OrientationMatrix | Array

scene orientation

Return:

undefined

public rotate(quaternion: Quaternion | Array): undefined source

rotate scene

Params:

NameTypeAttributeDescription
quaternion Quaternion | Array

rotation quaternion

Return:

undefined

public spin(axis: Vector3 | Array, angle: Number): undefined source

spin scene on axis

Params:

NameTypeAttributeDescription
axis Vector3 | Array

rotation axis

angle Number

amount to spin

Return:

undefined

public translate(vector: Vector3 | Array): undefined source

translate scene

Params:

NameTypeAttributeDescription
vector Vector3 | Array

translation vector

Return:

undefined

public zoom(delta: Number): undefined source

zoom scene

Params:

NameTypeAttributeDescription
delta Number

zoom change

Return:

undefined