Skip to content

Commit

Permalink
Merge pull request #20370 from sz-p/fix-20363
Browse files Browse the repository at this point in the history
Fix 20363
  • Loading branch information
Ovilia authored Sep 26, 2024
2 parents 2c6ecb0 + 80438d2 commit 38613d2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/coord/polar/Polar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class Polar implements CoordinateSystem, CoordinateSystemMaster {
const angleExtent = angleAxis.getExtent();

const RADIAN = Math.PI / 180;

const EPSILON = 1e-4;
return {
cx: this.cx,
cy: this.cy,
Expand All @@ -228,12 +228,13 @@ class Polar implements CoordinateSystem, CoordinateSystemMaster {
// Start angle and end angle don't matter
const dx = x - this.cx;
const dy = y - this.cy;
// minus a tiny value 1e-4 to avoid being clipped unexpectedly
const d2 = dx * dx + dy * dy - 1e-4;
const d2 = dx * dx + dy * dy;
const r = this.r;
const r0 = this.r0;

return d2 <= r * r && d2 >= r0 * r0;
// minus a tiny value 1e-4 in double side to avoid being clipped unexpectedly
// r == r0 contain nothing
return r !== r0 && (d2 - EPSILON) <= r * r && (d2 + EPSILON) >= r0 * r0;
}
};
}
Expand Down
39 changes: 39 additions & 0 deletions test/clip.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 38613d2

Please sign in to comment.