Skip to content

Commit

Permalink
Refactor new bbox
Browse files Browse the repository at this point in the history
  • Loading branch information
mitjak committed Jan 31, 2024
1 parent 2f3785a commit 8e71dc2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/layer/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,9 @@ export function ensureMercatorBBox(bbox: BBox): BBox {
return bbox;
}

let newBBox: BBox;
[newBBox.minX, newBBox.minY] = proj4(bbox.crs.authId, CRS_EPSG3857.authId, [bbox.minX, bbox.minY]);
[newBBox.maxX, newBBox.maxY] = proj4(bbox.crs.authId, CRS_EPSG3857.authId, [bbox.maxX, bbox.maxY]);
newBBox.crs = CRS_EPSG3857;

return newBBox;
const [minX, minY] = proj4(bbox.crs.authId, CRS_EPSG3857.authId, [bbox.minX, bbox.minY]);
const [maxX, maxY] = proj4(bbox.crs.authId, CRS_EPSG3857.authId, [bbox.maxX, bbox.maxY]);
return new BBox(CRS_EPSG3857, minX, minY, maxX, maxY);
}

export function metersPerPixel(bbox: BBox, width: number): number {
Expand Down

0 comments on commit 8e71dc2

Please sign in to comment.