import { IZoomCallbacks } from "../Interface/IZoomCallbacks"; /** * Represents zoom meta data. */ export interface ZoomData { minZoomScale: number; maxZoomScale: number; previousZoomScale: number; currentZoomScale: number; } export interface ZoomProperties { isZoomEnabled: boolean; zoomType: ZoomType; } /** * x and y are coordinates of cursor position on the image relative to zoomed/scaled image */ export interface CursorPosition { x: number; y: number; } /** * Enum indicating zoom behavior */ export declare enum ZoomDirection { In = 0, Out = 1 } /** * This indicates the point around which an image will be zoomed in our out. */ export declare enum ZoomType { Default = 0, ImageCenter = 1, ViewportCenter = 2, CursorCenter = 3 } /** * The manager for zoom functionality. */ export declare class ZoomManager { /** * [Gets] The boolean flag that indicates if zoom settings needs to be reset when new content is loaded to canvas. */ get resetZoomOnContentLoad(): boolean; /** * [Sets] The boolean flag that indicates if zoom settings needs to be reset when new content is loaded to canvas. */ set resetZoomOnContentLoad(reset: boolean); /** * Gets the singleton instance of Zoom Manager. * @param isZoomEnabled - Flag that indicates if zoom is enabled. * @param zoomCallbacks - [Optional] The collection of zoom callbacks. * @param maxZoom - [Optional] Maximum zoom factor. * @param zoomScale - [Optional] Incremental/Decremental zoom factor. */ static getInstance(isZoomEnabled?: boolean, editorContainerDiv?: HTMLDivElement, zoomCallbacks?: IZoomCallbacks, maxZoom?: number, zoomScale?: number): ZoomManager; /** * This holds the current instance of zoomManager. */ private static instance; /** * This decides whether zoom is enabled for the project. */ isZoomEnabled: boolean; /** * This indicates the point around which an image will be zoomed in our out. */ zoomType: ZoomType; /** * The collection of zoom callbacks. */ callbacks: IZoomCallbacks; isDraggingEnabled: boolean; /** * The minimum zoom factor. * Defaults to 1 or 100%. */ private minZoomScale; /** * The maximum zoom factor. * Defaults to 4 or 400%. */ private maxZoomScale; /** * The factor or scale at which the zoom in / zoom out works incrementally. */ private zoomScale; /** * This holds the current scale at which the image is zoomed at. */ private currentZoomScale; /** * This holds the previous scale at which the image is zoomed at. */ private previousZoomScale; /** * boolean that states if the zoom needs to be reset on content update. Defaults to false. */ private shouldResetZoomOnContentLoad; private zoomCanvas; private pos; private constructor(); /** * Updates the zoom values based on the direction of zoom. * @param zoomType - The direction of zoom. * @returns - Zoom data object. */ updateZoomScale(zoomType: ZoomDirection, newScale?: number): ZoomData; /** * Sets the maximum zoom scale. * @param maxZoomScale - The maximum zoom scale. */ setMaxZoomScale(maxZoomScale: number): void; /** * Sets the zoom scale. * @param zoomScale - Zoom factor. */ setZoomScale(zoomScale: number): void; /** * Gets the zoomData object. * @returns - Zoom data object. */ getZoomData(): ZoomData; /** * Deletes the single instance of zoom manager. */ deleteInstance(): void; /** * Helper function to subscribe manager to drag events */ setDragging(activate: boolean): void; private mouseDownHandler; private mouseUpHandler; private mouseMoveHandler; }