Skip to content

copper3d / Modules / Controls/Copper3dOrbitControls / Copper3dOrbitControls

Class: Copper3dOrbitControls ​

Controls/Copper3dOrbitControls.Copper3dOrbitControls

Hierarchy ​

  • OrbitControls

    ↳ Copper3dOrbitControls

Table of contents ​

Constructors ​

Properties ​

Accessors ​

Methods ​

Constructors ​

constructor ​

• new Copper3dOrbitControls(camera, domElement)

Parameters ​

NameType
cameraPerspectiveCamera | OrthographicCamera
domElementHTMLElement

Overrides ​

OrbitControls.constructor

Defined in ​

src/Controls/Copper3dOrbitControls.ts:41

Properties ​

_currentPreset ​

• Private _currentPreset: null | CameraViewPreset = null

Defined in ​

src/Controls/Copper3dOrbitControls.ts:38


_dist ​

• Private _dist: number = 600

Defined in ​

src/Controls/Copper3dOrbitControls.ts:37


_onStart ​

• Private Readonly _onStart: () => void

Type declaration ​

▸ (): void

Returns ​

void

Defined in ​

src/Controls/Copper3dOrbitControls.ts:39


_pivot ​

• Private _pivot: Vector3

Defined in ​

src/Controls/Copper3dOrbitControls.ts:36


autoRotate ​

• autoRotate: boolean

Set to true to automatically rotate around the target. Note that if this is enabled, you must call .update() in your animation loop. If you want the auto-rotate speed to be independent of the frame rate (the refresh rate of the display), you must pass the time deltaTime, in seconds, to .update().

Inherited from ​

OrbitControls.autoRotate

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:161


autoRotateSpeed ​

• autoRotateSpeed: number

How fast to rotate around the target if .autoRotate is true. Default is 2.0, which equates to 30 seconds per orbit at 60fps. Note that if .autoRotate is enabled, you must call .update() in your animation loop.

Inherited from ​

OrbitControls.autoRotateSpeed

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:168


cursor ​

• cursor: Vector3

The focus point of the .minTargetRadius and .maxTargetRadius limits. It can be updated manually at any point to change the center of interest for the .target.

Inherited from ​

OrbitControls.cursor

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:34


dampingFactor ​

• dampingFactor: number

The damping inertia used if .enableDamping is set to true. Default is 0.05. Note that for this to work, you must call .update() in your animation loop.

Inherited from ​

OrbitControls.dampingFactor

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:99


domElement ​

• domElement: null | HTMLElement | SVGElement

The HTML element used for event listeners. If not provided via the constructor, .connect must be called after domElement has been set.

Inherited from ​

OrbitControls.domElement

Defined in ​

node_modules/@types/three/src/extras/Controls.d.ts:22


enableDamping ​

• enableDamping: boolean

Set to true to enable damping (inertia), which can be used to give a sense of weight to the controls. Default is false. Note that if this is enabled, you must call .update() in your animation loop.

Inherited from ​

OrbitControls.enableDamping

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:93


enablePan ​

• enablePan: boolean

Enable or disable camera panning. Default is true.

Inherited from ​

OrbitControls.enablePan

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:132


enableRotate ​

• enableRotate: boolean

Enable or disable horizontal and vertical rotation of the camera. Default is true. Note that it is possible to disable a single axis by setting the min and max of the [polar angle].minPolarAngle or [azimuth angle].minAzimuthAngle to the same value, which will cause the vertical or horizontal rotation to be fixed at that value.

Inherited from ​

OrbitControls.enableRotate

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:117


enableZoom ​

• enableZoom: boolean

Enable or disable zooming (dollying) of the camera.

Inherited from ​

OrbitControls.enableZoom

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:104


enabled ​

• enabled: boolean

When set to false, the controls will not respond to user input. Default is true.

Inherited from ​

OrbitControls.enabled

Defined in ​

node_modules/@types/three/src/extras/Controls.d.ts:27


keyPanSpeed ​

• keyPanSpeed: number

How fast to pan the camera when the keyboard is used. Default is 7.0 pixels per keypress.

Inherited from ​

OrbitControls.keyPanSpeed

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:148


keyRotateSpeed ​

• keyRotateSpeed: number

How fast to rotate the camera when the keyboard is used. Default is 1.

Inherited from ​

OrbitControls.keyRotateSpeed

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:127


keys ​

• keys: Object

This object contains references to the keycodes for controlling camera panning. Default is the 4 arrow keys.

Type declaration ​

NameType
BOTTOMstring
LEFTstring
RIGHTstring
UPstring

Inherited from ​

OrbitControls.keys

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:173


maxAzimuthAngle ​

• maxAzimuthAngle: number

How far you can orbit horizontally, upper limit. If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ). Default is Infinity.

Inherited from ​

OrbitControls.maxAzimuthAngle

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:86


maxDistance ​

• maxDistance: number

How far you can dolly out ( PerspectiveCamera only ). Default is Infinity.

Inherited from ​

OrbitControls.maxDistance

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:44


maxPolarAngle ​

• maxPolarAngle: number

How far you can orbit vertically, upper limit. Range is 0 to Math.PI radians, and default is Math.PI.

Inherited from ​

OrbitControls.maxPolarAngle

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:74


maxTargetRadius ​

• maxTargetRadius: number

How far you can move the target from the 3D .cursor. Default is Infinity.

Inherited from ​

OrbitControls.maxTargetRadius

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:64


maxZoom ​

• maxZoom: number

How far you can zoom out ( OrthographicCamera only ). Default is Infinity.

Inherited from ​

OrbitControls.maxZoom

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:54


minAzimuthAngle ​

• minAzimuthAngle: number

How far you can orbit horizontally, lower limit. If set, the interval [ min, max ] must be a sub-interval of [ - 2 PI, 2 PI ], with ( max - min < 2 PI ). Default is Infinity.

Inherited from ​

OrbitControls.minAzimuthAngle

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:80


minDistance ​

• minDistance: number

How far you can dolly in ( PerspectiveCamera only ). Default is 0.

Inherited from ​

OrbitControls.minDistance

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:39


minPolarAngle ​

• minPolarAngle: number

How far you can orbit vertically, lower limit. Range is 0 to Math.PI radians, and default is 0.

Inherited from ​

OrbitControls.minPolarAngle

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:69


minTargetRadius ​

• minTargetRadius: number

How close you can get the target to the 3D .cursor. Default is 0.

Inherited from ​

OrbitControls.minTargetRadius

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:59


minZoom ​

• minZoom: number

How far you can zoom in ( OrthographicCamera only ). Default is 0.

Inherited from ​

OrbitControls.minZoom

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:49


mouseButtons ​

• mouseButtons: Object

This object contains references to the mouse actions used by the controls.

Type declaration ​

NameType
LEFT?null | MOUSE
MIDDLE?null | MOUSE
RIGHT?null | MOUSE

Inherited from ​

OrbitControls.mouseButtons

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:178


object ​

• object: Camera

The 3D object that is managed by the controls.

Inherited from ​

OrbitControls.object

Defined in ​

node_modules/@types/three/src/extras/Controls.d.ts:16


panSpeed ​

• panSpeed: number

Speed of panning. Default is 1.

Inherited from ​

OrbitControls.panSpeed

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:137


position0 ​

• position0: Vector3

Used internally by the .saveState and .reset methods.

Inherited from ​

OrbitControls.position0

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:197


rotateSpeed ​

• rotateSpeed: number

Speed of rotation. Default is 1.

Inherited from ​

OrbitControls.rotateSpeed

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:122


screenSpacePanning ​

• screenSpacePanning: boolean

Defines how the camera's position is translated when panning. If true, the camera pans in screen space. Otherwise, the camera pans in the plane orthogonal to the camera's up direction. Default is true.

Inherited from ​

OrbitControls.screenSpacePanning

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:143


target ​

• target: Vector3

The focus point of the controls, the .object orbits around this. It can be updated manually at any point to change the focus of the controls.

Inherited from ​

OrbitControls.target

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:28


target0 ​

• target0: Vector3

Used internally by the .saveState and .reset methods.

Inherited from ​

OrbitControls.target0

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:192


touches ​

• touches: Object

This object contains references to the touch actions used by the controls.

Type declaration ​

NameType
ONE?null | TOUCH
TWO?null | TOUCH

Inherited from ​

OrbitControls.touches

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:187


zoom0 ​

• zoom0: number

Used internally by the .saveState and .reset methods.

Inherited from ​

OrbitControls.zoom0

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:202


zoomSpeed ​

• zoomSpeed: number

Speed of zooming / dollying. Default is 1.

Inherited from ​

OrbitControls.zoomSpeed

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:109


zoomToCursor ​

• zoomToCursor: boolean

Setting this property to true allows to zoom to the cursor's position. Default is false.

Inherited from ​

OrbitControls.zoomToCursor

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:153

Accessors ​

cursorStyle ​

• get cursorStyle(): "grab" | "auto"

Returns ​

"grab" | "auto"

Inherited from ​

OrbitControls.cursorStyle

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:212

• set cursorStyle(type): void

Parameters ​

NameType
type"grab" | "auto"

Returns ​

void

Inherited from ​

OrbitControls.cursorStyle

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:211

Methods ​

addEventListener ​

▸ addEventListener<T>(type, listener): void

Adds a listener to an event type.

Type parameters ​

NameType
Textends keyof OrbitControlsEventMap

Parameters ​

NameTypeDescription
typeTThe type of event to listen to.
listenerEventListener<OrbitControlsEventMap[T], T, Copper3dOrbitControls>The function that gets called when the event is fired.

Returns ​

void

Inherited from ​

OrbitControls.addEventListener

Defined in ​

node_modules/@types/three/src/core/EventDispatcher.d.ts:52


applyView ​

▸ applyView(preset): void

Apply a view preset. Equivalent to copperScene.loadView but never touches up0. Authoritative + idempotent: saveState() at the end makes reset() mean "back to this view's initial framing".

Parameters ​

NameType
presetCameraViewPreset

Returns ​

void

Defined in ​

src/Controls/Copper3dOrbitControls.ts:119


connect ​

▸ connect(element): void

Connects the controls to the DOM. This method has so called "side effects" since it adds the module's event listeners to the DOM.

Parameters ​

NameType
elementHTMLElement | SVGElement

Returns ​

void

Inherited from ​

OrbitControls.connect

Defined in ​

node_modules/@types/three/src/extras/Controls.d.ts:40


disconnect ​

▸ disconnect(): void

Disconnects the controls from the DOM.

Returns ​

void

Inherited from ​

OrbitControls.disconnect

Defined in ​

node_modules/@types/three/src/extras/Controls.d.ts:45


dispatchEvent ​

▸ dispatchEvent<T>(event): void

Fire an event type.

Type parameters ​

NameType
Textends keyof OrbitControlsEventMap

Parameters ​

NameTypeDescription
eventBaseEvent<T> & OrbitControlsEventMap[T]The event that gets fired.

Returns ​

void

Inherited from ​

OrbitControls.dispatchEvent

Defined in ​

node_modules/@types/three/src/core/EventDispatcher.d.ts:81


dispose ​

▸ dispose(): void

Returns ​

void

Overrides ​

OrbitControls.dispose

Defined in ​

src/Controls/Copper3dOrbitControls.ts:136


dollyIn ​

▸ dollyIn(dollyScale): void

Programmatically dolly in (zoom in for perspective camera).

Parameters ​

NameTypeDescription
dollyScalenumberThe dolly scale factor.

Returns ​

void

Inherited from ​

OrbitControls.dollyIn

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:264


dollyOut ​

▸ dollyOut(dollyScale): void

Programmatically dolly out (zoom out for perspective camera).

Parameters ​

NameTypeDescription
dollyScalenumberThe dolly scale factor.

Returns ​

void

Inherited from ​

OrbitControls.dollyOut

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:271


frameBox ​

▸ frameBox(box): void

Frame a bounding box: pivot = box centre, auto distance from box size and the camera's fov, min/max zoom limits, then re-apply the current view so near/far are recomputed for the new size. The caller supplies the box (e.g. the union of the three orthogonal NRRD slice planes) so this class stays engine-agnostic.

Perspective cameras only: auto-framing derives the distance from the vertical fov, which an OrthographicCamera does not have. Rather than silently produce a NaN camera position (model vanishes), we warn and skip for a non-perspective camera.

Parameters ​

NameType
boxBox3

Returns ​

void

Defined in ​

src/Controls/Copper3dOrbitControls.ts:93


getAzimuthalAngle ​

▸ getAzimuthalAngle(): number

Get the current horizontal rotation, in radians.

Returns ​

number

Inherited from ​

OrbitControls.getAzimuthalAngle

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:222


getDistance ​

▸ getDistance(): number

Returns the distance from the camera to the target.

Returns ​

number

Inherited from ​

OrbitControls.getDistance

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:227


getPolarAngle ​

▸ getPolarAngle(): number

Get the current vertical rotation, in radians.

Returns ​

number

Inherited from ​

OrbitControls.getPolarAngle

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:217


hasEventListener ​

▸ hasEventListener<T>(type, listener): boolean

Checks if listener is added to an event type.

Type parameters ​

NameType
Textends keyof OrbitControlsEventMap

Parameters ​

NameTypeDescription
typeTThe type of event to listen to.
listenerEventListener<OrbitControlsEventMap[T], T, Copper3dOrbitControls>The function that gets called when the event is fired.

Returns ​

boolean

Inherited from ​

OrbitControls.hasEventListener

Defined in ​

node_modules/@types/three/src/core/EventDispatcher.d.ts:62


listenToKeyEvents ​

▸ listenToKeyEvents(domElement): void

Adds key event listeners to the given DOM element. window is a recommended argument for using this method.

Parameters ​

NameType
domElementWindow | HTMLElement

Returns ​

void

Inherited from ​

OrbitControls.listenToKeyEvents

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:233


pan ​

▸ pan(deltaX, deltaY): void

Programmatically pan the camera.

Parameters ​

NameTypeDescription
deltaXnumberThe horizontal pan amount in pixels.
deltaYnumberThe vertical pan amount in pixels.

Returns ​

void

Inherited from ​

OrbitControls.pan

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:257


refreshPole ​

▸ Private refreshPole(up): void

Rewrite OrbitControls' cached orbit-pole quaternion from the given up.

r170 caches _quat once in the constructor from object.up and never recomputes it in update() (OrbitControls.js:132 sets it; :299/:388 only consume it), so after a view change the pole would be stale. Writing these private fields is acceptable: three is version-pinned to 0.170.0.

Parameters ​

NameType
upVector3

Returns ​

void

Defined in ​

src/Controls/Copper3dOrbitControls.ts:149


removeEventListener ​

▸ removeEventListener<T>(type, listener): void

Removes a listener from an event type.

Type parameters ​

NameType
Textends keyof OrbitControlsEventMap

Parameters ​

NameTypeDescription
typeTThe type of the listener that gets removed.
listenerEventListener<OrbitControlsEventMap[T], T, Copper3dOrbitControls>The listener function that gets removed.

Returns ​

void

Inherited from ​

OrbitControls.removeEventListener

Defined in ​

node_modules/@types/three/src/core/EventDispatcher.d.ts:72


reset ​

▸ reset(): void

Reset the controls to their state from either the last time the .saveState was called, or the initial state.

Returns ​

void

Inherited from ​

OrbitControls.reset

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:249


rotateLeft ​

▸ rotateLeft(angle): void

Programmatically rotate the camera left (around the vertical axis).

Parameters ​

NameTypeDescription
anglenumberThe rotation angle in radians.

Returns ​

void

Inherited from ​

OrbitControls.rotateLeft

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:278


rotateUp ​

▸ rotateUp(angle): void

Programmatically rotate the camera up (around the horizontal axis).

Parameters ​

NameTypeDescription
anglenumberThe rotation angle in radians.

Returns ​

void

Inherited from ​

OrbitControls.rotateUp

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:285


saveState ​

▸ saveState(): void

Save the current state of the controls. This can later be recovered with .reset.

Returns ​

void

Inherited from ​

OrbitControls.saveState

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:243


setPivot ​

▸ setPivot(pivot): void

The point rotation orbits; a rotate gesture snaps target back to it.

Parameters ​

NameType
pivotVector3

Returns ​

void

Defined in ​

src/Controls/Copper3dOrbitControls.ts:79


stopListenToKeyEvents ​

▸ stopListenToKeyEvents(): void

Removes the key event listener previously defined with .listenToKeyEvents().

Returns ​

void

Inherited from ​

OrbitControls.stopListenToKeyEvents

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:238


update ​

▸ update(deltaTime?): boolean

Update the controls. Must be called after any manual changes to the camera's transform, or in the update loop if .autoRotate or .enableDamping are set. deltaTime, in seconds, is optional, and is only required if you want the auto-rotate speed to be independent of the frame rate (the refresh rate of the display).

Parameters ​

NameType
deltaTime?null | number

Returns ​

boolean

Inherited from ​

OrbitControls.update

Defined in ​

node_modules/@types/three/examples/jsm/controls/OrbitControls.d.ts:292