mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Update snapshot and comment
This commit is contained in:
parent
3fe73e79a6
commit
9a8aabbeca
2 changed files with 15 additions and 7 deletions
|
@ -817,8 +817,8 @@ exports[`history > multiplayer undo/redo > conflicts in arrows and their bindabl
|
||||||
"strokeWidth": 2,
|
"strokeWidth": 2,
|
||||||
"type": "arrow",
|
"type": "arrow",
|
||||||
"updated": 1,
|
"updated": 1,
|
||||||
"version": 30,
|
"version": 28,
|
||||||
"width": 0,
|
"width": 50,
|
||||||
"x": 200,
|
"x": 200,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
}
|
}
|
||||||
|
@ -852,7 +852,7 @@ History {
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
0,
|
50,
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -938,7 +938,7 @@ History {
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
0,
|
50,
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
@ -82,13 +82,21 @@ export const ellipseTouchesPoint = <Point extends GenericPoint>(
|
||||||
ellipse: Ellipse<Point>,
|
ellipse: Ellipse<Point>,
|
||||||
threshold = PRECISION,
|
threshold = PRECISION,
|
||||||
) => {
|
) => {
|
||||||
return ellipseDistance(point, ellipse) <= threshold;
|
return ellipseDistanceFromPoint(point, ellipse) <= threshold;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ellipseDistance = <Point extends GenericPoint>(
|
/**
|
||||||
|
* 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 = <Point extends GenericPoint>(
|
||||||
p: Point,
|
p: Point,
|
||||||
ellipse: Ellipse<Point>,
|
ellipse: Ellipse<Point>,
|
||||||
) => {
|
): number => {
|
||||||
const { angle, halfWidth, halfHeight, center } = ellipse;
|
const { angle, halfWidth, halfHeight, center } = ellipse;
|
||||||
const a = halfWidth;
|
const a = halfWidth;
|
||||||
const b = halfHeight;
|
const b = halfHeight;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue