Skip to content

Commit ebc5622

Browse files
fix: prevent negative left-shift when using negative zoomOffset (#2133)
1 parent 13db5de commit ebc5622

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/src/layer/tile_layer/tile_coordinates.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ class TileCoordinatesResolver {
7777
if (!replicatesWorldLongitude) {
7878
return positionCoordinates;
7979
}
80-
if (positionCoordinates.z < 0) {
80+
final z = positionCoordinates.z + zoomOffset;
81+
if (z < 0) {
8182
return positionCoordinates;
8283
}
83-
final modulo = 1 << (positionCoordinates.z + zoomOffset);
84+
final modulo = 1 << z;
8485
int x = positionCoordinates.x;
8586
while (x < 0) {
8687
x += modulo;

0 commit comments

Comments
 (0)