mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Another algo forpaddings
This commit is contained in:
parent
e6ade3b627
commit
7d0d6aec7a
1 changed files with 11 additions and 18 deletions
|
@ -116,25 +116,18 @@ const calculatePadding = (
|
||||||
startBoundingBox: Bounds,
|
startBoundingBox: Bounds,
|
||||||
endBoundingBox: Bounds,
|
endBoundingBox: Bounds,
|
||||||
) => {
|
) => {
|
||||||
const width = aabb[2] - aabb[0];
|
return Math.min(
|
||||||
const height = aabb[3] - aabb[1];
|
Math.hypot(
|
||||||
const size = Math.max(width, height);
|
|
||||||
const startExtent = Math.max(
|
|
||||||
startBoundingBox[2] - startBoundingBox[0],
|
startBoundingBox[2] - startBoundingBox[0],
|
||||||
startBoundingBox[3] - startBoundingBox[1],
|
startBoundingBox[3] - startBoundingBox[1],
|
||||||
10,
|
) / 4,
|
||||||
);
|
Math.hypot(
|
||||||
const endExtent = Math.max(
|
|
||||||
endBoundingBox[2] - endBoundingBox[0],
|
endBoundingBox[2] - endBoundingBox[0],
|
||||||
endBoundingBox[3] - endBoundingBox[1],
|
endBoundingBox[3] - endBoundingBox[1],
|
||||||
10,
|
) / 4,
|
||||||
|
Math.hypot(aabb[2] - aabb[0], aabb[3] - aabb[1]) / 4,
|
||||||
|
40,
|
||||||
);
|
);
|
||||||
|
|
||||||
return Math.min(startExtent, endExtent) < 80
|
|
||||||
? Math.min(startExtent, endExtent) / 2
|
|
||||||
: size > 75
|
|
||||||
? 40
|
|
||||||
: Math.min(Math.max(Math.min(width / 2 - 1, height / 2 - 1), 10), 40);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSegmentRenormalization = (
|
const handleSegmentRenormalization = (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue