UNPKG

@plait/draw

Version:

Implementation of the core logic of the flowchart drawing tool plugin.

37 lines (36 loc) 2.45 kB
import { PlaitBoard, PlaitElement, Point, RectangleClient } from '@plait/core'; import { DrawOptions, DrawShapes, PlaitBaseGeometry, PlaitCommonGeometry, PlaitCustomGeometry, PlaitDrawElement, PlaitGeometry, PlaitShapeElement } from '../interfaces'; import { Alignment } from '@plait/common'; import { Options } from 'roughjs/bin/core'; import { PlaitBaseTable } from '../interfaces/table'; import { DrawTextInfo } from '../generators/text.generator'; export declare const getTextRectangle: <T extends PlaitElement = PlaitGeometry>(element: T) => { height: any; width: number; x: any; y: number; }; export declare const getStrokeWidthByElement: (element: PlaitElement) => any; export declare const insertElement: (board: PlaitBoard, element: PlaitBaseGeometry | PlaitBaseTable) => void; export declare const isDrawElementIncludeText: (element: PlaitDrawElement) => boolean; export declare const isDrawElementsIncludeText: (elements: PlaitDrawElement[]) => boolean; export declare const isClosedDrawElement: (element: PlaitElement) => boolean; export declare const isClosedCustomGeometry: (board: PlaitBoard, value: PlaitElement) => value is PlaitCustomGeometry; export declare const getSnappingShape: (board: PlaitBoard, point: Point) => PlaitShapeElement | null; export declare const getSnappingRef: (board: PlaitBoard, hitElement: PlaitShapeElement, point: Point) => { isHitEdge: boolean; isHitConnector: boolean; connectorPoint: Point | undefined; edgePoint: Point; }; export declare const getHitShape: (board: PlaitBoard, point: Point, offset?: number) => PlaitShapeElement | null; export declare const traverseDrawShapes: (board: PlaitBoard, callback: (element: PlaitShapeElement) => void) => void; export declare const drawShape: (board: PlaitBoard, outerRectangle: RectangleClient, shape: DrawShapes, roughOptions: Options, drawOptions?: DrawOptions) => SVGGElement; export declare const drawBoundReaction: (board: PlaitBoard, element: PlaitShapeElement, roughOptions?: { hasMask: boolean; hasConnector: boolean; }) => SVGGElement; export declare const getTextKey: (element: PlaitElement | undefined, text: Pick<DrawTextInfo, "id">) => string; export declare const getGeometryAlign: (board: PlaitBoard, element: PlaitCommonGeometry | PlaitBaseTable) => Alignment; export declare const isClosedPoints: (points: Point[]) => boolean; export declare const getDefaultGeometryText: (board: PlaitBoard) => string;