From 15cb30efc96f156586ddf5e40be5e13fd8d5cd14 Mon Sep 17 00:00:00 2001 From: Jeff Sisson Date: Thu, 12 Sep 2024 08:33:44 -0400 Subject: [PATCH] swap left shift operators for Math.pow for scoped projection/unprojection (#172) * swap left shift operators for Math.pow for scoped projection/unprojection * use ** operator instead --- src/frontends/static.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontends/static.ts b/src/frontends/static.ts index dfd43ebd..f055c4f3 100644 --- a/src/frontends/static.ts +++ b/src/frontends/static.ts @@ -36,7 +36,7 @@ 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); }; }; @@ -44,7 +44,7 @@ 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,