import L from '@edgepdf/core'; import type { ImageInfo, ZoomConfig, ZoomState } from '@edgepdf/types'; /** * ZoomController - Manages zoom state and operations for the viewer * * This class provides: * - Zoom state management * - Zoom level calculations from image dimensions * - Zoom constraints enforcement * - Responsive initial zoom calculation * - Zoom control methods (zoomIn, zoomOut, setZoom) * - Zoom event handling * * @example * ```typescript * const zoomController = new ZoomController({ * map: leafletMap, * imageInfo: { * width: 2000, * height: 3000, * tileSize: 256, * maxZoom: 5, * minZoom: 0 * } * }); * * // Zoom in * zoomController.zoomIn(); * * // Zoom out * zoomController.zoomOut(); * * // Set specific zoom level * zoomController.setZoom(3); * * // Get current zoom state * const state = zoomController.getZoomState(); * ``` */ export declare class ZoomController { private map; private imageInfo; private config; private zoomState; private zoomChangeListeners; /** * Creates a new ZoomController instance * * @param options - Configuration options * @param options.map - Leaflet map instance * @param options.imageInfo - Image information for zoom calculations * @param options.config - Optional zoom configuration (overrides imageInfo zoom levels) * * @throws {Error} If map is not provided or invalid * @throws {Error} If imageInfo is invalid */ constructor(options: { map: L.Map; imageInfo: ImageInfo; config?: Partial; }); /** * Calculates maximum zoom level from image dimensions * * The calculation considers: * - Image dimensions and tile size * - Sharp pixel limit (16,383px per dimension) for performance * - Practical maximum zoom level (typically 5) * * @returns Calculated maximum zoom level */ calculateMaxZoomFromDimensions(): number; /** * Calculates optimal initial zoom based on viewport size * * Mobile devices start zoomed out for overview, desktop starts with more detail. * * @returns Calculated initial zoom level */ calculateOptimalInitialZoom(): number; /** * Constrains a zoom level to the valid range * * @param zoom - Zoom level to constrain * @returns Constrained zoom level within [minZoom, maxZoom] */ constrainZoom(zoom: number): number; /** * Validates if a zoom level is within the valid range * * @param zoom - Zoom level to validate * @returns True if zoom is valid, false otherwise */ isValidZoom(zoom: number): boolean; /** * Zooms in by the configured zoom delta * * @param options - Optional zoom options * @param options.animate - Whether to animate the zoom (default: true) * @returns True if zoom was successful, false if already at max zoom */ zoomIn(options?: { animate?: boolean; }): boolean; /** * Zooms out by the configured zoom delta * * @param options - Optional zoom options * @param options.animate - Whether to animate the zoom (default: true) * @returns True if zoom was successful, false if already at min zoom */ zoomOut(options?: { animate?: boolean; }): boolean; /** * Sets the zoom level to a specific value * * @param zoom - Target zoom level * @param options - Optional zoom options * @param options.animate - Whether to animate the zoom (default: true) * @throws {Error} If zoom level is not a finite number */ setZoom(zoom: number, options?: { animate?: boolean; }): void; /** * Gets the current zoom state * * @returns Current zoom state */ getZoomState(): ZoomState; /** * Gets the current zoom level * * @returns Current zoom level */ getZoom(): number; /** * Gets the minimum zoom level * * @returns Minimum zoom level */ getMinZoom(): number; /** * Gets the maximum zoom level * * @returns Maximum zoom level */ getMaxZoom(): number; /** * Checks if zoom can be increased * * @returns True if zoom can be increased, false otherwise */ canZoomIn(): boolean; /** * Checks if zoom can be decreased * * @returns True if zoom can be decreased, false otherwise */ canZoomOut(): boolean; /** * Adds a listener for zoom change events * * @param listener - Callback function called when zoom changes * @returns Function to remove the listener */ onZoomChange(listener: (state: ZoomState) => void): () => void; /** * Removes all zoom change listeners */ removeAllListeners(): void; /** * Sets up zoom event listeners on the map */ private setupZoomListeners; /** * Disposes of the zoom controller and cleans up resources */ dispose(): void; } //# sourceMappingURL=zoom-controller.d.ts.map