ArcballControls class

@param {Camera} camera Virtual camera used in the scene @param {HTMLElement} domElement Renderer's dom element @param {Scene} scene The scene to be rendered

Mixed-in types
  • EventDispatcher

Constructors

ArcballControls(dynamic camera, dynamic listenableKey, [dynamic scene, dynamic devicePixelRatio = 1.0])

Properties

adjustNearFar bool
getter/setter pair
camera ↔ Camera
getter/setter pair
cursorZoom bool
getter/setter pair
dampingFactor int
getter/setter pair
domElement DomLikeListenableState
no setter
enableAnimations bool
getter/setter pair
enabled bool
getter/setter pair
enableGizmos bool
getter/setter pair
enableGrid bool
getter/setter pair
enablePan bool
getter/setter pair
enableRotate bool
getter/setter pair
enableZoom bool
getter/setter pair
focusAnimationTime int
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
listenableKey GlobalKey<DomLikeListenableState>
getter/setter pair
maxDistance double
getter/setter pair
maxFov double
getter/setter pair
maxZoom double
getter/setter pair
minDistance double
getter/setter pair
minFov double
getter/setter pair
minZoom double
getter/setter pair
mouseActions List
getter/setter pair
radiusFactor double
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleFactor double
getter/setter pair
scene ↔ Scene?
getter/setter pair
scope OrbitControls
getter/setter pair
target ↔ Vector3
getter/setter pair
wMax int
getter/setter pair

Methods

activateGizmos(dynamic isActive) → dynamic
Make rotation gizmos more or less visible @param {Boolean} isActive If true, make gizmos more visible
addEventListener(String type, Function listener) → void
inherited
applyTransformMatrix(dynamic transformation) → dynamic
Apply a transformation matrix, to the camera and gizmos @param {Object} transformation Object containing matrices to apply to camera and gizmos
calculateAngularSpeed(dynamic p0, dynamic p1, dynamic t0, dynamic t1) → dynamic
Calculate the angular speed @param {Number} p0 Position at t0 @param {Number} p1 Position at t1 @param {Number} t0 Initial time in milliseconds @param {Number} t1 Ending time in milliseconds
calculatePointersDistance(dynamic p0, dynamic p1) → dynamic
Calculate the distance between two pointers @param {PointerEvent} p0 The first pointer @param {PointerEvent} p1 The second pointer @returns {number} The distance between the two pointers
calculateRotationAxis(dynamic vec1, dynamic vec2) → dynamic
Calculate the rotation axis as the vector perpendicular between two vectors @param {Vector3} vec1 The first vector @param {Vector3} vec2 The second vector @returns {Vector3} The normalized rotation axis
calculateTbRadius(Camera camera) → dynamic
Calculate the trackball radius so that gizmo's diamater will be 2/3 of the minimum side of the camera frustum @param {Camera} camera @returns {Number} The trackball radius
cancelAnimationFrame(dynamic instance) → dynamic
clearListeners() → void
inherited
compareMouseAction(dynamic action1, dynamic action2) → dynamic
Compare two mouse actions @param {Object} action1 @param {Object} action2 @returns {Boolean} True if action1 and action 2 are the same mouse action, false otherwise
copyState() → dynamic
dispatchEvent(Event event) → void
inherited
dispose() → dynamic
Remove all listeners, stop animations and clean scene
disposeGrid() → dynamic
remove the grid from the scene
drawGrid() → dynamic
Draw a grid and add it to the scene
easeOutCubic(dynamic t) → dynamic
Compute the easing out cubic function for ease out effect in animation @param {Number} t The absolute progress of the animation in the bound of 0 (beginning of the) and 1 (ending of animation) @returns {Number} Result of easing out cubic at time t
focus(dynamic point, dynamic size, [dynamic amount = 1]) → dynamic
Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in @param {Vector3} point The point of interest @param {Number} size Scale factor @param {Number} amount Amount of operation to be completed (used for focus animations, default is complete full operation)
getAngle(dynamic p1, dynamic p2) → dynamic
Calculate the angle between two pointers @param {PointerEvent} p1 @param {PointerEvent} p2 @returns {Number} The angle between two pointers in degrees
getCursorNDC(dynamic cursorX, dynamic cursorY, dynamic canvas) → dynamic
Calculate the cursor position in NDC @param {number} x Cursor horizontal coordinate within the canvas @param {number} y Cursor vertical coordinate within the canvas @param {HTMLElement} canvas The canvas where the renderer draws its output @returns {Vector2} Cursor normalized position inside the canvas
getCursorPosition(dynamic cursorX, dynamic cursorY, dynamic canvas) → dynamic
Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas @param {Number} x Cursor horizontal coordinate within the canvas @param {Number} y Cursor vertical coordinate within the canvas @param {HTMLElement} canvas The canvas where the renderer draws its output @returns {Vector2} Cursor position inside the canvas
getOpFromAction(dynamic mouse, dynamic key) → dynamic
Return the operation associated to a mouse/keyboard combination @param {} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches @param {} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed @returns The operation if it has been found, null otherwise
getOpStateFromAction(dynamic mouse, dynamic key) → dynamic
Get the operation associated to mouse and key combination and returns the corresponding FSA state @param {Number} mouse Mouse button @param {String} key Keyboard modifier @returns The FSA state obtained from the operation associated to mouse/keyboard combination
getRaycaster() → dynamic
hasEventListener(String type, Function listener) bool
inherited
initializeMouseActions() → dynamic
Set default mouse actions
makeGizmos(dynamic tbCenter, dynamic tbRadius) → dynamic
Creates the rotation gizmos matching trackball center and radius @param {Vector3} tbCenter The trackball center @param {number} tbRadius The trackball radius
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onContextMenu(dynamic event) → dynamic
onDoublePanEnd(dynamic event) → dynamic
onDoublePanMove() → dynamic
onDoublePanStart() → dynamic
onDoubleTap(dynamic event) → dynamic
onFocusAnim(dynamic time, dynamic point, dynamic cameraMatrix, dynamic gizmoMatrix) → dynamic
Perform animation for focus operation @param {Number} time Instant in which this function is called as performance.now() @param {Vector3} point Point of interest for focus operation @param {Matrix4} cameraMatrix Camera matrix @param {Matrix4} gizmoMatrix Gizmos matrix
onPinchEnd(dynamic event) → dynamic
onPinchMove() → dynamic
onPinchStart() → dynamic
onPointerCancel() → dynamic
onPointerDown(dynamic event) → dynamic
onPointerMove(dynamic event) → dynamic
onPointerUp(dynamic event) → dynamic
onRotateEnd(dynamic event) → dynamic
onRotateMove() → dynamic
onRotateStart() → dynamic
onRotationAnim(dynamic time, dynamic rotationAxis, dynamic w0) → dynamic
Perform animation for rotation operation @param {Number} time Instant in which this function is called as performance.now() @param {Vector3} rotationAxis Rotation axis @param {number} w0 Initial angular velocity
onSinglePanEnd() → dynamic
onSinglePanMove(dynamic event, dynamic opState) → dynamic
onSinglePanStart(dynamic event, dynamic operation) → dynamic
onTriplePanEnd() → dynamic
onTriplePanMove(dynamic event) → dynamic
onTriplePanStart(dynamic event) → dynamic
onWheel(dynamic event) → dynamic
onWindowResize() → dynamic
pan(dynamic p0, dynamic p1, [dynamic adjust = false]) → dynamic
Perform pan operation moving camera between two points @param {Vector3} p0 Initial point @param {Vector3} p1 Ending point @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only)
pasteState() → dynamic
removeEventListener(String type, Function listener) → void
inherited
requestAnimationFrame(Function callback) → dynamic
reset() → dynamic
Reset trackball
rotate(dynamic axis, dynamic angle) → dynamic
Rotate the camera around an axis passing by trackball's center @param {Vector3} axis Rotation axis @param {number} angle Angle in radians @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera
saveState() → dynamic
Save the current state of the control. This can later be recover with .reset
scale(dynamic size, dynamic point, [dynamic scaleGizmos = true]) → dynamic
Perform uniform scale operation around a given point @param {Number} size Scale factor @param {Vector3} point Point around which scale @param {Boolean} scaleGizmos If gizmos should be scaled (Perspective only) @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos
setCamera(dynamic camera) → dynamic
Set the camera to be controlled @param {Camera} camera The virtual camera to be controlled
setCenter(dynamic clientX, dynamic clientY) → dynamic
Set _center's x/y coordinates @param {Number} clientX @param {Number} clientY
setFov(dynamic value) → dynamic
Set camera fov @param {Number} value fov to be setted
setGizmosVisible(dynamic value) → dynamic
Set gizmos visibility @param {Boolean} value Value of gizmos visibility
setMouseAction(String operation, dynamic mouse, [String? key]) → dynamic
Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one @param {String} operation The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV) @param {} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches @param {} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed @returns {Boolean} True if the mouse action has been successfully added, false otherwise
setStateFromJSON(dynamic json) → dynamic
setTbRadius(dynamic value) → dynamic
Set gizmos radius factor and redraws gizmos @param {Float} value Value of radius factor
setTransformationMatrices([Matrix4? camera, Matrix4? gizmos]) → dynamic
Set values in transformation object @param {Matrix4} camera Transformation to be applied to the camera @param {Matrix4} gizmos Transformation to be applied to gizmos
toString() String
A string representation of this object.
inherited
unprojectOnObj(dynamic cursor, dynamic camera) → dynamic
Unproject the cursor on the 3D object surface @param {Vector2} cursor Cursor coordinates in NDC @param {Camera} camera Virtual camera @returns {Vector3} The point of intersection with the model, if exist, null otherwise
unprojectOnTbPlane(dynamic camera, dynamic cursorX, dynamic cursorY, dynamic canvas, [dynamic initialDistance = false]) → dynamic
Unproject the cursor on the plane passing through the center of the trackball orthogonal to the camera @param {Camera} camera The virtual camera @param {Number} cursorX Cursor horizontal coordinate on screen @param {Number} cursorY Cursor vertical coordinate on screen @param {HTMLElement} canvas The canvas where the renderer draws its output @param {Boolean} initialDistance If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only) @returns {Vector3} The unprojected point on the trackball plane
unprojectOnTbSurface(dynamic camera, dynamic cursorX, dynamic cursorY, dynamic canvas, dynamic tbRadius) → dynamic
Unproject the cursor on the trackball surface @param {Camera} camera The virtual camera @param {Number} cursorX Cursor horizontal coordinate on screen @param {Number} cursorY Cursor vertical coordinate on screen @param {HTMLElement} canvas The canvas where the renderer draws its output @param {number} tbRadius The trackball radius @returns {Vector3} The unprojected point on the trackball surface
unsetMouseAction(dynamic mouse, [String? key]) → dynamic
Remove a mouse action by specifying its mouse/key combination @param {} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches @param {} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed @returns {Boolean} True if the operation has been succesfully removed, false otherwise
update() → dynamic
updateMatrixState() → dynamic
Update camera and gizmos state
updateTbState(dynamic newState, dynamic updateMatrices) → dynamic
Update the trackball FSA @param {STATE2} newState New state of the FSA @param {Boolean} updateMatrices If matriices state should be updated
updateTouchEvent(dynamic event) → dynamic
Update a PointerEvent inside current pointerevents array @param {PointerEvent} event
zRotate(dynamic point, dynamic angle) → dynamic
Rotate camera around its direction axis passing by a given point by a given angle @param {Vector3} point The point where the rotation axis is passing trough @param {Number} angle Angle in radians @returns The computed transormation matix

Operators

operator ==(Object other) bool
The equality operator.
inherited