Fix condition where linear and freedraw cannot be unselected
This commit is contained in:
parent
2082ef149c
commit
508d4c3681
@ -14,6 +14,10 @@ import { elementCenterPoint } from "@excalidraw/common";
|
|||||||
|
|
||||||
import { distanceToElement } from "@excalidraw/element/distance";
|
import { distanceToElement } from "@excalidraw/element/distance";
|
||||||
|
|
||||||
|
import { isLinearElement } from "@excalidraw/excalidraw";
|
||||||
|
import { isFreeDrawElement } from "@excalidraw/element/typeChecks";
|
||||||
|
import { isPathALoop } from "@excalidraw/element/shapes";
|
||||||
|
|
||||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||||
|
|
||||||
import type { Curve } from "@excalidraw/math";
|
import type { Curve } from "@excalidraw/math";
|
||||||
@ -36,6 +40,14 @@ export const isPointInShape = (
|
|||||||
point: GlobalPoint,
|
point: GlobalPoint,
|
||||||
element: ExcalidrawElement,
|
element: ExcalidrawElement,
|
||||||
) => {
|
) => {
|
||||||
|
if (
|
||||||
|
(isLinearElement(element) || isFreeDrawElement(element)) &&
|
||||||
|
!isPathALoop(element.points)
|
||||||
|
) {
|
||||||
|
// There isn't any "inside" for a non-looping path
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const intersections = intersectElementWithLineSegment(
|
const intersections = intersectElementWithLineSegment(
|
||||||
element,
|
element,
|
||||||
lineSegment(elementCenterPoint(element), point),
|
lineSegment(elementCenterPoint(element), point),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user