mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix incorrect closing of path
This commit is contained in:
parent
5cf18b5926
commit
9a6330bad9
1 changed files with 2 additions and 8 deletions
|
@ -35,8 +35,6 @@ export const getLassoSelectedElementIds = (input: {
|
||||||
if (simplifyDistance) {
|
if (simplifyDistance) {
|
||||||
path = simplify(lassoPath, simplifyDistance) as GlobalPoint[];
|
path = simplify(lassoPath, simplifyDistance) as GlobalPoint[];
|
||||||
}
|
}
|
||||||
// close the path to form a polygon for enclosure check
|
|
||||||
const closedPath = polygonFromPoints(path);
|
|
||||||
// as the path might not enclose a shape anymore, clear before checking
|
// as the path might not enclose a shape anymore, clear before checking
|
||||||
enclosedElements.clear();
|
enclosedElements.clear();
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
|
@ -44,15 +42,11 @@ export const getLassoSelectedElementIds = (input: {
|
||||||
!intersectedElements.has(element.id) &&
|
!intersectedElements.has(element.id) &&
|
||||||
!enclosedElements.has(element.id)
|
!enclosedElements.has(element.id)
|
||||||
) {
|
) {
|
||||||
const enclosed = enclosureTest(closedPath, element, elementsSegments);
|
const enclosed = enclosureTest(path, element, elementsSegments);
|
||||||
if (enclosed) {
|
if (enclosed) {
|
||||||
enclosedElements.add(element.id);
|
enclosedElements.add(element.id);
|
||||||
} else {
|
} else {
|
||||||
const intersects = intersectionTest(
|
const intersects = intersectionTest(path, element, elementsSegments);
|
||||||
closedPath,
|
|
||||||
element,
|
|
||||||
elementsSegments,
|
|
||||||
);
|
|
||||||
if (intersects) {
|
if (intersects) {
|
||||||
intersectedElements.add(element.id);
|
intersectedElements.add(element.id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue