threepipe
Version:
A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.
60 lines (42 loc) • 2.38 kB
text/typescript
import {OrbitControls, OrbitControlsEventMap} 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 class OrbitControls3 extends OrbitControls implements IUiConfigContainer, ICameraControls<OrbitControlsEventMap> {
uiConfig?: UiObjectConfig<void, 'panel'>
type = 'OrbitControls'
enabled = true
dollyZoom = false
zoomToCursor = 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 = 1e6 // should be Infinity but this breaks the UI
minZoom = 0.01
maxZoom = 1e6 // should be Infinity but this breaks the UI
minPolarAngle = 0
maxPolarAngle = Math.PI
minAzimuthAngle = -1e6 // should be -Infinity but this breaks the UI
maxAzimuthAngle = 1e6 // should be Infinity but this breaks the UI
clampMin = new Vector3(-1e6, -1e6, -1e6) // should be -Infinity but this breaks the UI
clampMax = new Vector3(1e6, 1e6, 1e6) // 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)
stopDamping!: () => void
}