Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: repair TileLayer.tileBounds #1713

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions lib/src/layer/tile_layer/tile_bounds/tile_bounds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class WrappedTileBounds extends TileBounds {
) : super._();

@override
WrappedTileBoundsAtZoom atZoom(int zoom) {
TileBoundsAtZoom atZoom(int zoom) {
return _tileBoundsAtZoomCache.putIfAbsent(
zoom, () => _tileBoundsAtZoomImpl(zoom));
}
Expand All @@ -125,26 +125,24 @@ class WrappedTileBounds extends TileBounds {
);
}

final tzDouble = zoom.toDouble();

(int, int)? wrapX;
if (crs.wrapLng case final wrapLng?) {
final wrapXMin =
(crs.latLngToPoint(LatLng(0, wrapLng.$1), tzDouble).x / _tileSize)
(crs.latLngToPoint(LatLng(0, wrapLng.$1), zoomDouble).x / _tileSize)
.floor();
final wrapXMax =
(crs.latLngToPoint(LatLng(0, wrapLng.$2), tzDouble).x / _tileSize)
(crs.latLngToPoint(LatLng(0, wrapLng.$2), zoomDouble).x / _tileSize)
.ceil();
wrapX = (wrapXMin, wrapXMax - 1);
}

(int, int)? wrapY;
if (crs.wrapLat case final wrapLat?) {
final wrapYMin =
(crs.latLngToPoint(LatLng(wrapLat.$1, 0), tzDouble).y / _tileSize)
(crs.latLngToPoint(LatLng(wrapLat.$1, 0), zoomDouble).y / _tileSize)
.floor();
final wrapYMax =
(crs.latLngToPoint(LatLng(wrapLat.$2, 0), tzDouble).y / _tileSize)
(crs.latLngToPoint(LatLng(wrapLat.$2, 0), zoomDouble).y / _tileSize)
.ceil();
wrapY = (wrapYMin, wrapYMax - 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class WrappedTileBoundsAtZoom extends TileBoundsAtZoom {

bool _wrappedXInRange(TileCoordinates coordinates) {
final wrappedX = _wrapInt(coordinates.x, wrapX!);
return wrappedX >= tileRange.min.x && wrappedX <= tileRange.max.y;
return wrappedX >= tileRange.min.x && wrappedX <= tileRange.max.x;
}

bool _wrappedYInRange(TileCoordinates coordinates) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/map/options/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class MapOptions {
/// map themselves. Without this, only the top layer may handle gestures.
///
/// Note that layers that are visually obscured behind another layer will
/// recieve events, if this is enabled.
/// receive events, if this is enabled.
///
/// Technically, layers become invisible to the parent `Stack` when hit
/// testing (and thus `Stack` will keep bubbling gestures down all layers), but
Expand Down