threepipe
Version:
A 3D viewer framework built on top of three.js in TypeScript with a focus on quality rendering, modularity and extensibility.
60 lines (43 loc) • 2.33 kB
text/typescript
import {OrbitControls} from 'three/examples/jsm/controls/OrbitControls.js'
import {IUiConfigContainer, uiInput, UiObjectConfig, uiPanelContainer, uiToggle, uiVector} from 'uiconfig.js'
import {serialize} from 'ts-browser-helpers'
import {ICameraControls} from '../../core'
import {Vector3} from 'three'
export type TOrbitControlsEvents = 'change' | 'end' | 'start'
export class OrbitControls3 extends OrbitControls implements IUiConfigContainer, ICameraControls<TOrbitControlsEvents> {
uiConfig?: UiObjectConfig<void, 'panel'>
type = 'OrbitControls'
enabled = true
dollyZoom = false
enableDamping = true
dampingFactor = 0.08
autoRotate = false
autoRotateSpeed = 2.0
enableZoom = true
zoomSpeed = 0.15
maxZoomSpeed = 0.20
enableRotate = true
rotateSpeed = 2.0
enablePan = true
panSpeed = 1.0
autoPushTarget = false
autoPullTarget = false
minDistance = 0.35
maxDistance = 1000
minZoom = 0.01
maxZoom = 1000
minPolarAngle = 0
maxPolarAngle = Math.PI
minAzimuthAngle = -10000 // should be -Infinity but this breaks the UI
maxAzimuthAngle = 10000 // should be Infinity but this breaks the UI
clampMin = new Vector3(-10000, -10000, -10000) // should be -Infinity but this breaks the UI
clampMax = new Vector3(10000, 10000, 10000) // should be Infinity but this breaks the UI
// @uiToggle()
screenSpacePanning = true
// @uiInput()
keyPanSpeed = 7.0
throttleUpdate = 60 // throttle to 60 updates per second (implemented in OrbitControls.js.update() method)
// todo add to three-ts-types
stopDamping!: () => void
}