diff --git a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap index b473240946..c0c995884f 100644 --- a/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap +++ b/packages/excalidraw/tests/__snapshots__/history.test.tsx.snap @@ -817,8 +817,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl "strokeWidth": 2, "type": "arrow", "updated": 1, - "version": 30, - "width": 0, + "version": 28, + "width": 50, "x": 200, "y": 0, } @@ -852,7 +852,7 @@ History { 0, ], [ - 0, + 50, 0, ], ], @@ -938,7 +938,7 @@ History { 0, ], [ - 0, + 50, 0, ], ], diff --git a/packages/math/ellipse.ts b/packages/math/ellipse.ts index dd63cd814b..7127b6abc1 100644 --- a/packages/math/ellipse.ts +++ b/packages/math/ellipse.ts @@ -82,13 +82,21 @@ export const ellipseTouchesPoint = ( ellipse: Ellipse, threshold = PRECISION, ) => { - return ellipseDistance(point, ellipse) <= threshold; + return ellipseDistanceFromPoint(point, ellipse) <= threshold; }; -export const ellipseDistance = ( +/** + * Determine the shortest euclidean distance from a point to the + * outline of the ellipse + * + * @param p The point to consider + * @param ellipse The ellipse to calculate the distance to + * @returns The eucledian distance + */ +export const ellipseDistanceFromPoint = ( p: Point, ellipse: Ellipse, -) => { +): number => { const { angle, halfWidth, halfHeight, center } = ellipse; const a = halfWidth; const b = halfHeight;