Skip to content

Commit

Permalink
fix(Crs): correctly renamed reasonableEpsilon function
Browse files Browse the repository at this point in the history
BREAKING CHANGE: CRS.reasonnableEspsilon renamed to CRS.reasonableEpsilon
  • Loading branch information
Desplandis committed Nov 27, 2024
1 parent d467a29 commit 205c27f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Core/Geographic/Crs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ export function isValid(crs: ProjectionLike) {
}

/**
* Gives a reasonnable epsilon for this CRS.
* Gives a reasonable epsilon for this CRS.
*
* @param crs - The CRS to use.
* @returns 0.01 if the CRS is EPSG:4326, 0.001 otherwise.
*/
export function reasonnableEpsilon(crs: ProjectionLike) {
export function reasonableEpsilon(crs: ProjectionLike) {
if (is4326(crs)) {
return 0.01;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Geographic/Extent.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class Extent {
*/
isInside(extent, epsilon) {
extent.as(this.crs, _extent);
epsilon = epsilon == undefined ? CRS.reasonnableEpsilon(this.crs) : epsilon;
epsilon = epsilon ?? CRS.reasonableEpsilon(this.crs);
return this.east - _extent.east <= epsilon &&
_extent.west - this.west <= epsilon &&
this.north - _extent.north <= epsilon &&
Expand Down
6 changes: 3 additions & 3 deletions test/unit/crs.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ describe('CRS assertions', function () {
assert.ok(!CRS.isGeocentric('EPSG:3857'));
});

it('should return a reasonnable epsilon', function () {
assert.strictEqual(CRS.reasonnableEpsilon('EPSG:4326'), 0.01);
assert.strictEqual(CRS.reasonnableEpsilon('EPSG:3857'), 0.001);
it('should return a reasonable epsilon', function () {
assert.strictEqual(CRS.reasonableEpsilon('EPSG:4326'), 0.01);
assert.strictEqual(CRS.reasonableEpsilon('EPSG:3857'), 0.001);
});
});

0 comments on commit 205c27f

Please sign in to comment.