UNPKG

@gravity-ui/graph

Version:

Modern graph editor component

44 lines (43 loc) 1.34 kB
import { AnchorState, EAnchorType } from "../../../store/anchor/Anchor"; import { TBlockId } from "../../../store/block/Block"; import { TPoint } from "../../../utils/types/shapes"; import { GraphComponent } from "../GraphComponent"; import { GraphLayer, TGraphLayerContext } from "../layers/graphLayer/GraphLayer"; export type TAnchor = { id: string; blockId: TBlockId; type: EAnchorType | string; index?: number; }; export type TAnchorProps = TAnchor & { size: number; lineWidth: number; zIndex: number; getPosition: (anchor: TAnchor) => TPoint; }; type TAnchorState = { size: number; raised: boolean; selected: boolean; }; export declare class Anchor<T extends TAnchorProps = TAnchorProps> extends GraphComponent<T, TAnchorState> { readonly cursor = "pointer"; get zIndex(): number; state: TAnchorState; props: T; context: TGraphLayerContext; connectedState: AnchorState; private shift; private hitBoxHash; private debouncedSetHitBox; constructor(props: T, parent: GraphLayer); getPosition(): TPoint; toggleSelected(): void; protected isVisible(): boolean; protected unmount(): void; didIterate(): void; handleEvent(event: MouseEvent | KeyboardEvent): void; private computeRenderSize; protected render(): void; } export {};