import type { NVL } from '@neo4j-nvl/base'; import { BaseInteraction } from './base'; /** * Options for the click interaction handler to customize its behavior. */ export type PanInteractionOptions = { /** * Whether to not pan when dragging within a certain margin of a node * @defaultValue false */ excludeNodeMargin?: boolean; /** * If true, the interaction handler will not update the NVL instance directly. * Instead, it will only call the onPan callback with the calculated values, * allowing the parent application to control when and how to apply the pan update. * @defaultValue false */ controlledPan?: boolean; }; /** * Callbacks for the pan interaction handler. */ export type PanInteractionCallbacks = { /** * Called when the canvas is panned. * @param panning - The panning coordinates. * @param event - The original mouse event. */ onPan?: ((panning: { x: number; y: number; }, event: MouseEvent) => void) | boolean; }; /** * Interaction handler for panning the scene, which is achieved by clicking and moving the scene. * * For examples, head to the {@link https://neo4j.com/docs/nvl/current/interaction-handlers/#_paninteraction Pan Interaction documentation page}. */ export declare class PanInteraction extends BaseInteraction { private initialMousePosition; private initialPan; private targets; private shouldPan; private isPanning; /** * Creates a new instance of the pan interaction handler. * @param nvl - The NVL instance to attach the interaction handler to. */ constructor(nvl: NVL, options?: PanInteractionOptions); /** * Updates which type of graph elements should hinder panning. * @param targets - The graph elements that should hinder panning. * @param excludeNodeMargin - If true, the node margin will not hinder panning. * By default, panning is hindered by nodes and relationships. * * @example * ```js * import { NVL } from '@neo4j-nvl/base' * import { PanInteraction } from '@neo4j-nvl/interaction-handlers' * * const nvl = new NVL(document.createElement('div'), [{ id: '0' }], []) * const panInteraction = new PanInteraction(nvl) * * // Pan canvas even when dragging on nodes and relationships * panInteraction.updateTargets([], true) * ``` */ updateTargets: (targets: ("node" | "relationship")[], excludeNodeMargin: boolean) => void; private handleMouseDown; private handleMouseMove; private handleMouseUp; private resetPanState; /** * Removes the related event listeners from the canvas. */ destroy(): void; }