UNPKG

vega-tooltip

Version:

A tooltip plugin for Vega-Lite and Vega visualizations.

60 lines 1.75 kB
import { Bounds } from 'vega-typings'; import { Options, Position } from './defaults.js'; type MarkBounds = Pick<Bounds, 'x1' | 'x2' | 'y1' | 'y2'>; /** * Position the tooltip * * @param event The mouse event. * @param tooltipBox * @param options Tooltip handler options. */ export declare function calculatePositionRelativeToCursor(event: MouseEvent, tooltipBox: { width: number; height: number; }, { offsetX, offsetY }: Required<Options>): { x: number; y: number; }; /** * Calculates the position of the tooltip relative to the mark. * @param handler The handler instance. * @param event The mouse event. * @param item The item that the tooltip is being shown for. * @param tooltipBox Client rect of the tooltip element. * @param options Tooltip handler options. * @returns */ export declare function calculatePositionRelativeToMark(handler: any, event: MouseEvent, item: any, tooltipBox: { width: number; height: number; }, options: Required<Options>): { x: number; y: number; }; export declare function getMarkBounds(containerBox: { left: number; top: number; }, origin: [number, number], item: any): MarkBounds; export declare function getPositions(markBounds: MarkBounds, tooltipBox: { width: number; height: number; }, offsetX: number, offsetY: number): Record<Position, { x: number; y: number; }>; export declare function tooltipIsInViewport(position: { x: number; y: number; }, tooltipBox: { width: number; height: number; }): boolean; export declare function mouseIsOnTooltip(event: MouseEvent, position: { x: number; y: number; }, tooltipBox: { width: number; height: number; }): boolean; export {}; //# sourceMappingURL=position.d.ts.map