@gorpacrate/core-graphics
Version:
A core library for creating shape-based graphic editors
56 lines (55 loc) • 1.97 kB
TypeScript
import { IBoundingBox, IPoint, IScene, ISceneMode, IShapeData, IShapeResizeHandle, IShapesDeclarations } from '../declarations';
export declare function normalizeBB(bb: IBoundingBox): IBoundingBox;
export declare function padBB(padParams: {
left?: number;
right?: number;
top?: number;
bottom?: number;
}, bb: IBoundingBox): IBoundingBox;
export declare function roundBB(bb: IBoundingBox): IBoundingBox;
export declare function padBBEqual(p: number, bb: IBoundingBox): IBoundingBox;
export declare function getBBCenter(bb: IBoundingBox): {
x: number;
y: number;
};
export declare function getBoundingBoxFromTwoPoints(a: IPoint, b: IPoint): IBoundingBox;
export declare function doBoundingBoxesCollide(a: IBoundingBox, b: IBoundingBox): boolean;
export declare function getBoundingBoxFromNPoints(points: IPoint[]): IBoundingBox;
export declare function unionBoundingBoxes(bbs: IBoundingBox[]): IBoundingBox;
export declare function getShapesBoundingBoxes(params: {
shapesDeclarations: IShapesDeclarations;
shapes: {
[index: string]: IShapeData;
};
ids: string[];
}): {
id: string;
bb: IBoundingBox;
}[];
export declare function getSceneBB(params: {
scene: IScene;
shapesDeclarations: IShapesDeclarations;
}): IBoundingBox;
export declare function getShapeResizeHandleCoords(bb: IBoundingBox, handle: IShapeResizeHandle): {
x: number;
y: number;
};
export declare function getShapesResizeHandlesCoords(params: {
bb: IBoundingBox;
offset: number;
handles: IShapeResizeHandle[];
}): Array<{
handle: IShapeResizeHandle;
x: number;
y: number;
}>;
export declare function getShapesBoundingBox(params: {
shapesDeclarations: IShapesDeclarations;
scene: IScene;
ids: string[];
}): IBoundingBox;
export declare function getSelectedOrTransformedShapesBoundingBox(params: {
shapesDeclarations: IShapesDeclarations;
scene: IScene;
mode: ISceneMode;
}): IBoundingBox;