UNPKG

ag-charts-community

Version:

Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue

65 lines (64 loc) 2.72 kB
import type { DistantObject } from 'ag-charts-core'; import type { BBox } from '../bbox'; import { ExtendedPath2D } from '../extendedPath2D'; import type { ChildNodeCounts, RenderContext } from '../node'; import { Shape } from './shape'; export declare class Path<D = unknown> extends Shape<D> implements DistantObject { static readonly className: string; /** * Declare a path to retain for later rendering and hit testing * using custom Path2D class. Think of it as a TypeScript version * of the native Path2D (with some differences) that works in all browsers. * * Lazily allocated so subclasses that author their geometry elsewhere (e.g. `Marker`, which * shares an origin-centred path via the marker path cache) do not pay the per-instance * `ExtendedPath2D` allocation when `this.path` is never read. */ private _path?; get path(): ExtendedPath2D; set path(value: ExtendedPath2D); protected _clipX: number; protected _clipY: number; protected _clipPath?: ExtendedPath2D; clip: boolean; set clipX(value: number); set clipY(value: number); /** * The path only has to be updated when certain attributes change. * For example, if transform attributes (such as `translationX`) * are changed, we don't have to update the path. The `dirtyPath` flag * is how we keep track if the path has to be updated or not. */ private _dirtyPath; set dirtyPath(value: boolean); get dirtyPath(): boolean; checkPathDirty(): void; resetPathDirty(): void; isPathDirty(): boolean; onChangeDetection(property: string): void; protected computeBBox(): BBox | undefined; isPointInPath(x: number, y: number): boolean; distanceSquared(x: number, y: number): number; svgPathData(transform?: (x: number, y: number) => { x: number; y: number; }): string; protected distanceSquaredTransformedPoint(x: number, y: number): number; protected isDirtyPath(): boolean; updatePath(): void; protected updatePathIfDirty(): void; private lastPixelRatio; preRender(renderCtx: RenderContext): ChildNodeCounts; /** * Per-render complexity hint for {@link preRender}. Subclasses with externally-managed path * geometry (e.g. `Marker`, which uses a shared origin-centred path from a cache) override * this to avoid forcing `this.path` to lazy-allocate on every render. */ protected pathComplexity(): number; render(renderCtx: RenderContext): void; drawPath(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void; toSVG(): { elements: SVGElement[]; defs?: SVGElement[]; } | undefined; }