@gravity-ui/graph
Version:
Modern graph editor component
41 lines (40 loc) • 1.62 kB
TypeScript
import { TGraphLayerContext } from "../../components/canvas/layers/graphLayer/GraphLayer";
import { Layer, LayerContext, LayerProps } from "../../services/Layer";
import { TCameraState } from "../../services/camera/CameraService";
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> {
context: Omit<TGraphLayerContext, "ownerDocument" | "root">;
private minimapWidth;
private minimapHeight;
private relativeX;
private relativeY;
private scale;
private cameraBorderSize;
private cameraBorderColor;
constructor(props: MiniMapLayerProps);
protected afterInit(): void;
protected onCameraChange(_camera: TCameraState): void;
protected updateCanvasSize(): void;
protected willRender(): void;
protected render(): void;
private injectPositionStyle;
private calculateViewPortCoords;
private drawCameraBorderFrame;
protected getPositionOfMiniMap(location: TMiniMapLocation): Pick<CSSStyleDeclaration, "top" | "left" | "bottom" | "right">;
private renderUsableRectBelow;
private renderBlocks;
private onCameraDrag;
private handleMouseDownEvent;
}