@gravity-ui/graph
Version:
Modern graph editor component
41 lines (40 loc) • 1.59 kB
TypeScript
import { TGraphLayerContext } from "../../components/canvas/layers/graphLayer/GraphLayer";
import { Layer, LayerContext, LayerProps } from "../../services/Layer";
export type TMiniMapLocation = "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | Pick<CSSStyleDeclaration, "top" | "left" | "bottom" | "right">;
export type MiniMapLayerProps = LayerProps & {
width?: number;
height?: number;
classNames?: string[];
cameraBorderSize?: number;
cameraBorderColor?: string;
location?: TMiniMapLocation;
};
export type MiniMapLayerContext = LayerContext & {
canvas: HTMLCanvasElement;
ctx: CanvasRenderingContext2D;
};
export declare class MiniMapLayer extends Layer<MiniMapLayerProps, MiniMapLayerContext> {
context: Omit<TGraphLayerContext, "ownerDocument" | "root">;
private minimapWidth;
private minimapHeight;
private relativeX;
private relativeY;
private scale;
private cameraBorderSize;
private cameraBorderColor;
private unSubscribeUsableRectLoaded;
constructor(props: MiniMapLayerProps);
protected afterInit(): void;
protected updateCanvasSize(): void;
private calculateViewPortCoords;
private drawCameraBorderFrame;
protected getPositionOfMiniMap(location: TMiniMapLocation): Pick<CSSStyleDeclaration, "top" | "left" | "bottom" | "right">;
protected willRender(): void;
protected didRender(): void;
private onBlockUpdated;
private rerenderMapContent;
private renderUsableRectBelow;
private renderBlocks;
private onCameraDrag;
private handleMouseDownEvent;
}