From 08dd96eac54c7b2b40ef7b396b2dd9a7c731417a Mon Sep 17 00:00:00 2001 From: miyanokomiya Date: Sat, 6 Apr 2024 10:59:32 +0900 Subject: [PATCH] fix: Check each point as the closest outline even when the shape has a curve --- src/shapes/simplePolygon.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/shapes/simplePolygon.ts b/src/shapes/simplePolygon.ts index 9ee53757..bc91e1fe 100644 --- a/src/shapes/simplePolygon.ts +++ b/src/shapes/simplePolygon.ts @@ -176,12 +176,14 @@ export function getStructForSimplePolygon( if (rotatedClosest) return applyAffine(transform, rotatedClosest); } - // Ignore conventional markers when the shape has a curve. - // TODO: Some markers for straight segments may be available. - // TODO: Prepare some way to declare custom markers from inheritant structs. if (!curves) { + // Ignore conventional markers when the shape has a curve. const rotatedClosest = getMarkersOnPolygon(path).find((m) => getDistance(m, localP) <= threshold); if (rotatedClosest) return applyAffine(transform, rotatedClosest); + } else { + // Check each point when the shape doesn't have a curve. + const rotatedClosest = path.find((m) => getDistance(m, localP) <= threshold); + if (rotatedClosest) return applyAffine(transform, rotatedClosest); } {