@nightingale-elements/nightingale-new-core
Version:
Base Elements for Nightingale Components
30 lines • 1.31 kB
TypeScript
import { Selection } from "d3";
type AnySelection = Selection<any, unknown, any, unknown>;
/** Helper class to deal with customizing zoom behavior (e.g. only zooming when Ctrl is pressed, using horizontal scroll to pan) */
export declare class WheelHelper {
readonly target: AnySelection;
/** Function to be performed when user pans horizontally (by horizontal scroll, or Shift + vertical scroll ) */
handlePan?: (shift: number) => void;
scrollRequiresCtrl: boolean;
constructor(target: AnySelection);
dispose(): void;
/** Used to merge multiple wheel events into one gesture (needed for correct functioning on Mac touchpad) */
private readonly currentWheelGesture;
/** Categorize wheel event to one of action kinds */
wheelAction(e: WheelEvent): {
kind: 'ignore';
} | {
kind: 'zoom';
delta: number;
} | {
kind: 'pan';
deltaX: number;
deltaY: number;
};
/** Handle event coming directly from the mouse wheel (customizes basic D3 zoom behavior) */
private handleWheel;
/** Magic to handle touchpad scrolling on Mac (when user lifts fingers from touchpad, but the browser is still getting wheel events) */
private updateCurrentWheelGesture;
}
export {};
//# sourceMappingURL=wheel-helper.d.ts.map