Skip to content

Commit

Permalink
swap left shift operators for Math.pow for scoped projection/unprojec…
Browse files Browse the repository at this point in the history
…tion (#172)

* swap left shift operators for Math.pow for scoped projection/unprojection

* use ** operator instead
  • Loading branch information
saranrapjs authored Sep 12, 2024
1 parent 6580626 commit 15cb30e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/frontends/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ const instancedProject = (origin: Point, displayZoom: number) => {
(projected.x + MAXCOORD) / (MAXCOORD * 2),
1 - (projected.y + MAXCOORD) / (MAXCOORD * 2),
);
return normalized.mult((1 << displayZoom) * 256).sub(origin);
return normalized.mult(2 ** displayZoom * 256).sub(origin);
};
};

const instancedUnproject = (origin: Point, displayZoom: number) => {
return (point: Point) => {
const normalized = new Point(point.x, point.y)
.add(origin)
.div((1 << displayZoom) * 256);
.div(2 ** displayZoom * 256);
const projected = new Point(
normalized.x * (MAXCOORD * 2) - MAXCOORD,
(1 - normalized.y) * (MAXCOORD * 2) - MAXCOORD,
Expand Down

0 comments on commit 15cb30e

Please sign in to comment.