import type { NVL } from '@neo4j-nvl/base'; import { BaseInteraction } from './base'; /** * Options for the zoom interaction handler to customize its behavior. */ export type ZoomInteractionOptions = { /** * If true, the interaction handler will not update the NVL instance directly. * Instead, it will only call the onZoom callback with the calculated values, * allowing the parent application to control when and how to apply the zoom update. * @defaultValue false */ controlledZoom?: boolean; }; /** * Callbacks for the zoom interaction handler. */ export type ZoomInteractionCallbacks = { /** * Called when the canvas is zoomed. * @param zoomLevel - The zoom level. * @param event - The original mouse wheel event. * @deprecated Use {@link onZoomAndPan} instead. */ onZoom?: ((zoomLevel: number, event: WheelEvent) => void) | boolean; /** * Called when the canvas is zoomed and panned. * @param zoomLevel - The zoom level. * @param panX - The new pan X coordinate. * @param panY - The new pan Y coordinate. * @param event - The original mouse wheel event. */ onZoomAndPan?: ((zoomLevel: number, panX: number, panY: number, event: WheelEvent) => void) | boolean; }; /** * Interaction handler for zooming the canvas, which is achieved by: * - Scrolling the mouse wheel on the canvas * - Using trackpad pinch gestures (equivalent to Ctrl/Cmd + scroll) * * For examples, head to the {@link https://neo4j.com/docs/nvl/current/interaction-handlers/#_zoominteraction Zoom Interaction documentation page}. */ export declare class ZoomInteraction extends BaseInteraction { private zoomLimits; /** * Creates a new instance of the zoom interaction handler. * @param nvl - The NVL instance to attach the interaction handler to. * @param options - Options to customize the zoom interaction behavior. */ constructor(nvl: NVL, options?: ZoomInteractionOptions); /** * The function to be called on mouse wheel event on the canvas. * @param evt - The mouse wheel event. */ private handleWheel; /** * Throttled zoom function to avoid events happening too fast. * @param event - The original mouse wheel event. * * @remarks * "Wheel" with a touchpad, the wheel is triggered event a lot, * especially a lot of very small values. * However, updating values in NVL instance takes time. * Sometimes it lost the track of multiple events happening too soon. * As a result, the zoom might lose its anchor point under touch pad. * Therefore, the throttle is needed to avoid events happening too fast. * The throttle is set to 25ms. */ private throttledZoom; /** * Removes the relevant event listeners from the canvas. */ destroy: () => void; }