/** A camera: a content point `u` draws at `k * u + t`. */ export interface ViewCamera { /** Zoom factor. 1 draws content at its own size. */ k: number; tx: number; ty: number; } /** What a surface allows its camera to do. */ export interface ViewCameraLimits { minZoom: number; maxZoom: number; /** A content box, from the origin, that must keep covering a viewport of the same size. * Omit for a freely panning surface. */ cover?: { width: number; height: number; }; } /** The unzoomed, unpanned camera. */ export declare const IDENTITY_CAMERA: ViewCamera; /** How far a finger must travel before a one-finger drag counts as a pan, in px. */ export declare const PAN_SLOP = 8; /** * Hold the camera inside its limits. `k` lands in the zoom range; with a cover, the offsets * are held so the drawn content still covers the viewport. A non-finite field resolves to * the identity camera rather than drawing NaN. */ export declare function clampViewCamera(camera: ViewCamera, limits: ViewCameraLimits): ViewCamera; /** * Zoom to `k` about the drawn point (ax, ay), holding whatever content already sat under * that point still: u = (ax - tx) / k, then tx' = ax - k' * u. */ export declare function zoomViewCameraAt(camera: ViewCamera, k: number, ax: number, ay: number, limits: ViewCameraLimits): ViewCamera; /** Multiply the zoom about the drawn point (cx, cy), usually the viewport's centre. */ export declare function zoomViewCameraBy(camera: ViewCamera, factor: number, cx: number, cy: number, limits: ViewCameraLimits): ViewCamera; /** Slide the drawn content by (dx, dy) surface units, held inside the limits. */ export declare function panViewCameraBy(camera: ViewCamera, dx: number, dy: number, limits: ViewCameraLimits): ViewCamera; /** * The zoom factor a wheel gesture asks for. Exponential in the travel, so the zoom feels * the same at every factor, and symmetric: scrolling back the same distance lands exactly * where it started. `pxPerDoubling` is the travel that doubles the zoom. */ export declare function viewCameraWheelFactor(deltaPx: number, pxPerDoubling: number): number; /** The zoom factor a pinch asks for: how much the fingers have spread. */ export declare function viewCameraPinchFactor(startSpan: number, span: number): number; /** The point a drawn point (x, y) shows: the inverse of the camera. */ export declare function viewCameraToContent(camera: ViewCamera, x: number, y: number): { x: number; y: number; }; /** * The camera as the six-number matrix react-native-svg accepts identically on all three * platforms: `matrix(k, 0, 0, k, tx, ty)`. The numeric form is read straight, where a * transform string is parsed on every native update. */ export declare function viewCameraMatrix(camera: ViewCamera): [number, number, number, number, number, number]; /** One finger, in surface units. */ export interface ViewCameraTouch { x: number; y: number; } /** What a gesture latched when it began, so every move can be absolute. */ export interface ViewCameraGesture { camera: ViewCamera; /** Distance between the first two fingers when this was latched; 0 for one. */ span: number; /** Centroid of the fingers when this was latched. */ cx: number; cy: number; /** How many fingers were down. A change re-latches. */ touches: number; } export declare const VIEW_CAMERA_GESTURE_IDLE: ViewCameraGesture; /** * Advance a gesture. On "grant", and whenever the finger COUNT changes mid-gesture, this * latches the camera, the finger span and the centroid, and moves nothing. Every "move" * then recomputes FROM those latched values rather than accumulating: * * k' = latched.k * (span / latched.span) (one finger leaves k alone) * u = (latched.cx - latched.tx) / latched.k (the content under the centroid) * tx' = cx - k' * u (put it back under the centroid) * * Absolute, not incremental, so no drift accumulates over a long gesture, and two fingers * moving the same direction pan rather than zoom. * * Callers must read the fingers by ARRAY POSITION within one event, never match them by * identifier across events: react-native-web normalizes identifiers with `identifier % 20`, * so two touches can collide on one id. */ export declare function viewCameraGestureEvent(phase: "grant" | "move", touches: readonly ViewCameraTouch[], gesture: ViewCameraGesture, camera: ViewCamera, limits: ViewCameraLimits): { gesture: ViewCameraGesture; camera: ViewCamera; }; //# sourceMappingURL=view-camera.d.ts.map