UNPKG

@chemistry/mol3dview

Version:
64 lines (63 loc) 1.75 kB
import { Vec3 } from "@chemistry/math"; import { ICamera } from "./ICamera"; export declare class Camera implements ICamera { private element; /** * RootationMatrix */ private rootation; /** * TranSlation Matrix */ private translation; private projectionMatrix; private unprojectionMatrix; private mouseCapture; private mouseBegin; private mouseLast; private mouseCurrent; private mouseClick; private width; private height; private onRedrawCallBack; private onClickCallBack; constructor(options: { element: HTMLElement; onRedraw: () => void; onClick: (x: number, y: number) => void; }); onInit(): void; onDestroy(): void; /** * Transform from 3D coordinates to Screen coordinates */ project(position: Vec3): Vec3; /** * Transform screen coordinates to 3D coords */ unproject(position: Vec3): Vec3; extractScale(): number; /** * Set Transformation scale and Rootation center */ setCameraView(scale: number, center: Vec3): void; private attachLiseners(); private _mousedown(event); private _mouseup(event); private _mouseleave(event); private _mousemove(event); private _mousewheel(event); private processMouseClick(offsetX, offsetY, which); private processMouseMove(shiftKey, ctrlKey, which); private mouseRootate_XYZ(); private mouseRootateXY(); private mouseTranslate(); private mouseZoom(event); private whellZoom(event); private detachLiseners(); private onRedraw(); /** * Init projection Matrixes */ private initMatrixes(); }