Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
leyan committed Oct 17, 2024
1 parent 3ca46a0 commit ae56027
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/stylefunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,14 +832,15 @@ export function stylefunction(
const x2 = coordinates[i + stride];
const y2 = coordinates[i + stride + 1];
const minX = Math.min(x1, x2);
const minY = Math.min(y1, y2);
const maxX = Math.max(x1, x2);
const maxY = Math.max(y1, y2);
const xM = midpoint[0];
const yM = midpoint[1];
const dotProduct =
(y2 - y1) * (xM - x1) - (x2 - x1) * (yM - y1);
if (
Math.abs((y2-y1)*(xM-x1) - (x2-x1)*(yM-y1))<0.001 //midpoint is aligned with the segment
&& xM<=maxX && xM>=minX
Math.abs(dotProduct) < 0.001 && //midpoint is aligned with the segment
xM <= maxX &&
xM >= minX //midpoint is on the segment and not outside it
) {
placementAngle = Math.atan2(y1 - y2, x2 - x1);
break;
Expand Down

0 comments on commit ae56027

Please sign in to comment.