mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix target point well inside shape issues
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
parent
7af00ca9b7
commit
b63cd86cd6
1 changed files with 10 additions and 2 deletions
|
@ -27,7 +27,9 @@ import {
|
|||
PRECISION,
|
||||
} from "@excalidraw/math";
|
||||
|
||||
import { isPointOnShape } from "@excalidraw/utils/collision";
|
||||
import { isPointInShape, isPointOnShape } from "@excalidraw/utils/collision";
|
||||
|
||||
import { getEllipseShape, getPolygonShape } from "@excalidraw/utils/shape";
|
||||
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
|
@ -909,8 +911,14 @@ const getDistanceForBinding = (
|
|||
bindableElement.height,
|
||||
zoom,
|
||||
);
|
||||
const isInside = isPointInShape(
|
||||
point,
|
||||
bindableElement.type === "ellipse"
|
||||
? getEllipseShape(bindableElement)
|
||||
: getPolygonShape(bindableElement),
|
||||
);
|
||||
|
||||
return distance > bindDistance ? null : distance;
|
||||
return distance > bindDistance && !isInside ? null : distance;
|
||||
};
|
||||
|
||||
export const bindPointToSnapToElementOutline = (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue