fix: align and distribute binded text in container and cleanup (#4468)

This commit is contained in:
Aakansha Doshi
2021-12-23 17:02:13 +05:30
committed by GitHub
parent d0733b1960
commit bf2bca221e
4 changed files with 55 additions and 72 deletions

View File

@ -520,11 +520,24 @@ export interface Box {
minY: number;
maxX: number;
maxY: number;
midX: number;
midY: number;
width: number;
height: number;
}
export const getCommonBoundingBox = (
elements: ExcalidrawElement[] | readonly NonDeleted<ExcalidrawElement>[],
): Box => {
const [minX, minY, maxX, maxY] = getCommonBounds(elements);
return { minX, minY, maxX, maxY };
return {
minX,
minY,
maxX,
maxY,
width: maxX - minX,
height: maxY - minY,
midX: (minX + maxX) / 2,
midY: (minY + maxY) / 2,
};
};