/** * OrbitControls with medical-viewer defaults, a stable model-centre orbit pivot, * per-view pole refresh, and auto-framing. * * Drop-in swappable with Copper3dTrackballControls: same new X(camera, domElement) * signature and the same core surface (update / dispose / reset / target / * mouseButtons / enabled, inherited from OrbitControls), plus setPivot / frameBox / * applyView for the medical features. * * Seam: copperScene.render() calls controls.update() every frame, so assigning an * instance to copperScene.controls lets copper's own loop drive it — no extra rAF loop. * * Never drive the camera via copperScene.loadView(): it unconditionally touches * controls.up0, which OrbitControls does not have. applyView() replaces it. */ import * as THREE from 'three'; import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'; import { type CameraViewPreset } from './orbitFraming'; export declare class Copper3dOrbitControls extends OrbitControls { private _pivot; private _dist; private _currentPreset; private readonly _onStart; constructor(camera: THREE.PerspectiveCamera | THREE.OrthographicCamera, domElement: HTMLElement); /** The point rotation orbits; a rotate gesture snaps target back to it. */ setPivot(pivot: THREE.Vector3): 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. */ frameBox(box: THREE.Box3): 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". */ applyView(preset: CameraViewPreset): void; dispose(): 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. */ private refreshPole; }