@gravity-ui/graph
Version:
Modern graph editor component
30 lines (29 loc) • 1.61 kB
TypeScript
import { Component } from "../../../lib";
import { TComponentState } from "../../../lib/Component";
import { ConnectionState, TConnection, TConnectionId } from "../../../store/connection/ConnectionState";
import { TPoint } from "../../../utils/types/shapes";
import { GraphComponent, GraphComponentContext } from "../GraphComponent";
import { TAnchor } from "../anchors";
import { Block } from "../blocks/Block";
export type TBaseConnectionProps = {
id: TConnectionId;
};
export type TBaseConnectionState = TComponentState & TConnection & {
hovered?: boolean;
};
export declare class BaseConnection<Props extends TBaseConnectionProps = TBaseConnectionProps, State extends TBaseConnectionState = TBaseConnectionState, Context extends GraphComponentContext = GraphComponentContext, Connection extends TConnection = TConnection> extends GraphComponent<Props, State, Context> {
protected get sourceBlock(): Block;
protected get targetBlock(): Block;
protected get sourceAnchor(): TAnchor | undefined;
protected get targetAnchor(): TAnchor | undefined;
connectionPoints: [TPoint, TPoint] | undefined;
anchorsPoints: [TPoint, TPoint] | undefined;
protected connectedState: ConnectionState<Connection>;
protected bBox: [minX: number, minY: number, maxX: number, maxY: number];
constructor(props: Props, parent: Component);
protected willMount(): void;
protected handleEvent(event: any): void;
protected updatePoints(): void;
protected getBBox(): Readonly<[sourceX: number, sourceY: number, targetX: number, targetY: number]>;
private updateHitBox;
}