import L from '@edgepdf/core'; import type { ViewerConfig, MapOptions } from '@edgepdf/types'; import { TileLayerManager } from './tile-layer-manager.js'; import { CoordinateMapper } from './coordinate-mapper.js'; import { ZoomController } from './zoom-controller.js'; import { MarkerManager } from './marker-manager.js'; /** * EdgePdfViewer - Core class for initializing and managing Leaflet map instances * * This class provides the foundation for the EdgePDF viewer, handling: * - Leaflet map initialization with custom CRS * - Map container lifecycle management * - Basic cleanup and disposal * * @example * ```typescript * const viewer = new EdgePdfViewer({ * container: document.getElementById('map'), * config: { * tileUrl: 'https://example.com/tiles/{z}/{x}/{y}.png', * imageInfo: { * width: 2000, * height: 3000, * tileSize: 256, * maxZoom: 5, * minZoom: 0 * } * } * }); * * viewer.initialize(); * ``` */ export declare class EdgePdfViewer { private map; private container; private config; private mapOptions?; private tileLayerManager; private coordinateMapper; private zoomController; private markerManager; /** * Creates a new EdgePdfViewer instance * * @param options - Configuration options for the viewer * @param options.container - HTML element that will contain the map * @param options.config - Viewer configuration with tile URL and image info * @param options.mapOptions - Optional Leaflet map options * * @throws {Error} If container is not provided or invalid * @throws {Error} If config is not provided or invalid */ constructor(options: { container: HTMLElement; config: ViewerConfig; mapOptions?: MapOptions; }); /** * Initializes the Leaflet map with custom CRS * * Sets up a custom coordinate reference system (CRS.Simple) suitable for * displaying image tiles without geographic coordinates. * * @throws {Error} If map initialization fails */ initialize(): void; /** * Calculates optimal initial zoom based on device type * * Mobile devices start zoomed out for overview, desktop starts with more detail. * * @returns Calculated zoom level */ private calculateOptimalInitialZoom; /** * Gets the Leaflet map instance * * @returns The Leaflet map instance, or null if not initialized */ getMap(): L.Map | null; /** * Checks if the map is initialized * * @returns True if map is initialized, false otherwise */ isInitialized(): boolean; /** * Adds the tile layer to the map * * Creates a TileLayerManager and adds the tile layer to the initialized map. * This is called automatically during initialization. * * @throws {Error} If map is not initialized or tile layer creation fails */ private addTileLayer; /** * Gets the tile layer manager instance * * @returns The tile layer manager, or null if not created */ getTileLayerManager(): TileLayerManager | null; /** * Gets the coordinate mapper instance * * @returns The coordinate mapper, or null if not created */ getCoordinateMapper(): CoordinateMapper | null; /** * Gets the zoom controller instance * * @returns The zoom controller, or null if not created */ getZoomController(): ZoomController | null; /** * Gets the marker manager instance * * @returns The marker manager, or null if not created */ getMarkerManager(): MarkerManager | null; /** * Focuses on a marker by panning and zooming to its position * * This is a convenience method that delegates to the marker manager's focusMarker method. * * @param markerOrId - Marker ID string or Marker object * @param options - Optional focus options * @param options.zoom - Target zoom level (uses marker's zoom or default if not provided) * @param options.animate - Whether to animate the transition (default: true) * @param options.duration - Animation duration in seconds (default: 0.5) * @param options.offsetLeft - Pixel offset to move focus marker to the left (default: 0) * @param options.offsetRight - Pixel offset to move focus marker to the right (default: 0) * @param options.offsetTop - Pixel offset to move focus marker upward (default: 0) * @param options.offsetBottom - Pixel offset to move focus marker downward (default: 0) * @returns True if focus was successful, false if marker not found or viewer not initialized * * @example * ```typescript * // Focus on marker by ID * viewer.focusMarker('marker-123'); * * // Focus with specific zoom level * viewer.focusMarker('marker-123', { zoom: 3 }); * * // Focus with offset to account for overlay * viewer.focusMarker('marker-123', { offsetLeft: 100, offsetTop: 50 }); * ``` */ focusMarker(markerOrId: string | import('@edgepdf/types').Marker, options?: { zoom?: number; animate?: boolean; duration?: number; offsetLeft?: number; offsetRight?: number; offsetTop?: number; offsetBottom?: number; }): boolean; /** * Disposes of the map instance and cleans up resources * * This should be called when the viewer is no longer needed to prevent * memory leaks and event listener issues. */ dispose(): void; } //# sourceMappingURL=viewer.d.ts.map