UNPKG

@deltares/fews-web-oc-charts

Version:
72 lines (71 loc) 2.61 kB
import type { Axes } from '../Axes/axes.js'; import { CartesianAxes, D3Selection, ModifierKey } from '../index.js'; import type { Visitor } from './visitor.js'; export type ZoomHandlerEventType = 'zoom' | 'reset-zoom'; export interface CartesianDomain { x: [number, number] | [Date, Date]; y: [number, number] | [Date, Date]; } export interface ZoomEvent { mode: ZoomMode; targetAxes: CartesianAxes[]; } export type ResetZoomEvent = Omit<ZoomEvent, 'mode'>; export type ZoomCallback = (event: ZoomEvent) => void; export type ResetZoomCallback = (event: ResetZoomEvent) => void; export declare const ZoomMode: { X: string; XY: string; Y: string; }; export declare const SelectionMode: { X: string; XY: string; Y: string; CANCEL: string; }; export type ZoomMode = (typeof ZoomMode)[keyof typeof ZoomMode]; export declare const WheelMode: { X: string; XY: string; Y: string; NONE: string; }; export type WheelMode = (typeof WheelMode)[keyof typeof WheelMode]; export interface ZoomHandlerOptions { wheelMode: WheelMode; sharedZoomMode: ZoomMode; scrollModifierKey: ModifierKey; } type BrushGroup = D3Selection<SVGElement, null>; export declare class ZoomHandler implements Visitor { private brushStartPoint; private axes; private mode; private options; private readonly MINMOVE; private lastPoint; private zoomCallbacks; private resetZoomCallbacks; private onMouseMove; constructor(wheelMode?: WheelMode, scrollModifierKey?: ModifierKey); constructor(options?: Partial<ZoomHandlerOptions>); addEventListener(event: 'zoom', callback: ZoomCallback): void; addEventListener(event: 'reset-zoom', callback: ResetZoomCallback): void; removeEventListener(event: 'zoom', callback: ZoomCallback): void; removeEventListener(event: 'reset-zoom', callback: ResetZoomCallback): void; visit(axis: Axes): void; updateOptions(options: Partial<ZoomHandlerOptions>): void; createHandler(axis: CartesianAxes): void; private updateWheelMode; private dispatchZoomEvent; private updateZoomAxisScales; zoom(axis: CartesianAxes, factor: number, point: [number, number]): void; initSelection(axis: Axes, mouseGroup: any, brushGroup: BrushGroup, point: [number, number]): void; updateSelection(axis: Axes, brushGroup: BrushGroup, point: [number, number]): void; private updateAxisScales; endSelection(axis: CartesianAxes, mouseGroup: any, brushGroup: BrushGroup, point: [number, number]): void; resetZoom(axis: Axes): void; redraw(): void; } export {};