Skip to content

Commit

Permalink
fix: Check each point as the closest outline even when the shape has …
Browse files Browse the repository at this point in the history
…a curve
  • Loading branch information
miyanokomiya committed Apr 6, 2024
1 parent aa923a8 commit 08dd96e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/shapes/simplePolygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,14 @@ export function getStructForSimplePolygon<T extends SimplePolygonShape>(
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);
}

{
Expand Down

0 comments on commit 08dd96e

Please sign in to comment.