import { _PanzoomAnimation, PanzoomAnimation } from './animation.js'; import { Kinetic } from './kinetic.js'; import { PanzoomTransform, PanzoomTransformCallback } from './transform.js'; import { ClientPos } from './vector.js'; export declare class Panzoom { readonly element: HTMLElement; /** * What scrolling one wheel click towards you multiplies the zoom factor by. */ wheelZoomRate: number; /** * Maximum zoom factor */ maxZoom: number; /** * Minimum zoom factor */ minZoom: number; /** * If set, ensures the user cannot lose the panzoomed element by dragging it completely outside the viewport, * with at least this many px of it remaining as a partial border. */ minVisible?: number | undefined; /** * The parent of the element passed to the constructor. */ readonly container: HTMLElement; /** * The kinetic scrolling controller for this panzoom */ readonly kinetic: Kinetic; private readonly transform; private readonly transformCallbacks; /** * Modifies the internal transform then updates it on the panzoom element * @param change - how to modify the internal transform */ editTransform(change: (t: PanzoomTransform) => void): void; /** * Gets a copy of the internal transform */ getTransform(): PanzoomTransform; /** * Adds a callback that will be called whenever the transform changes. * You can remove it by calling `unsubscribe` on the return value. * @param cb - the callback */ onTransformChanged(cb: PanzoomTransformCallback): { unsubscribe: () => boolean; }; /** * Like {@link editTransform}, but respects viewport constraints * @param change - how to modify the internal transform */ editTransformConstrained(change: (t: PanzoomTransform) => void): void; /** * The currently running animation, if any. */ protected anim: PanzoomAnimation | undefined; /** * Computes a change to the internal transform and animates a transition towards it. * @param change - how to modify the internal transform * @param duration - how long the animation should last in milliseconds * @param easing - the css easing function to use */ animateTransform(change: (t: PanzoomTransform) => void, duration?: number, easing?: string): Promise<_PanzoomAnimation>; interruptAnimation(): Promise; /** Converts a document-space position to a child-space position, without any scaling applied, and returns that. */ docToChild(pos: Readonly): ClientPos; /** Converts a child-space position to a document-space position, without any scaling applied, and returns that. */ childToDoc(pos: Readonly): ClientPos; /** Finds a new value for {@link z} to clamp `this.transform.zoom * z` between {@linkcode minZoom} and {@linkcode maxZoom} */ clampZoomChangeMul(z: number): number; /** * Constructs a panzoom for the element, with the parent serving as the boundary * @param element - the element */ constructor(element: HTMLElement); /** * If using this in the context of a framework, **call this when the panzoom goes out-of-scope**. * * *(If you don't, you'll probably get event listener memory leaks!)* */ dispose: () => void; private blockMobileScrolling; private blockScrollingIfPanning; /** * Callback for wheel events. * * Can be overridden. */ protected doWheelZoom(e: WheelEvent): Promise; /** The position of the mouse from the last mouse event. */ protected lastMousePos: ClientPos | undefined; /** A `performance.now()` timestamp from the last mouse event. */ protected lastMouseTime: number | undefined; /** * Callback for mouse events. * * Can be overridden. */ protected startMousePan(e: MouseEvent): Promise; /** The average touch position from the last touch event */ protected lastTouchAverage: ClientPos | undefined; /** The number of touches observed in the last touch event */ protected lastTouchCount: number | undefined; /** The distance between the touch points from the last touch event */ protected lastTouchDistance: number | undefined; /** A `performance.now()` timestamp from the last touch event. */ protected lastTouchTime: number | undefined; /** * Callback for touch events. * * Can be overridden. */ protected startTouchPanzoom(e: TouchEvent): Promise; } //# sourceMappingURL=panzoom.d.ts.map