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,
|
||||
endBoundingBox: Bounds,
|
||||
) => {
|
||||
const width = aabb[2] - aabb[0];
|
||||
const height = aabb[3] - aabb[1];
|
||||
const size = Math.max(width, height);
|
||||
const startExtent = Math.max(
|
||||
return Math.min(
|
||||
Math.hypot(
|
||||
startBoundingBox[2] - startBoundingBox[0],
|
||||
startBoundingBox[3] - startBoundingBox[1],
|
||||
10,
|
||||
);
|
||||
const endExtent = Math.max(
|
||||
) / 4,
|
||||
Math.hypot(
|
||||
endBoundingBox[2] - endBoundingBox[0],
|
||||
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 = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue