-
-
Notifications
You must be signed in to change notification settings - Fork 893
fix: prevent negative left-shift when using negative zoomOffset
#2133
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
Conversation
JaffaKetchup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, everything's got to be perfect with you! 😉 That said, as explained I couldn't see how to test the code, more specifically cases with a |
|
To be fair, I don't know necessarily what I would expect to see with a negative zoom offset - maybe that screenshot is what it's supposed to be? I'll have a look at what it looked like on an older version. |
|
Maybe this is working correctly. Using this code to test: TileLayer(
zoomOffset: -1,
minNativeZoom: 1,
maxNativeZoom: 18,
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'dev.fleaflet.flutter_map.example',
tileProvider: NetworkTileProvider(httpClient: httpClient),
);I think yesterday I tested without a Sorry, you're right 😅 |
JaffaKetchup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this works correctly. Will try to ask original reporter to test, but seems to be OK. Thanks and apologies :)
zoomOffset
|
Hi, thanks for the fix. When do changes reach pub.dev? |
|
Hey @mash-g, I'd be interested to know if this actually fixes an issue you have - I guess a negative offset is more common than I expected 😂 But in answer, we have no fixed release schedule. Likely this one will be waiting for a little bit unless there's another more critical fix soon - I would like to release them faster, but it requires coordination from the rest of the maintainer team, so it's usually not too quick. I'll open a PR for the release, but have to wait for a review before it can be merged and released. |
|
Hey @JaffaKetchup, I re-confirmed that with flutter_map v8.2.1, the app generates a "Invalid argument(s): -1" exception which is resolved when the app is linked with the latest version from the main branch. Interestingly, the exception doesn't seem to occur while the map is zoomed in to street level, but becomes guaranteed as the map is zoomed out to country level. Stack for above exception: #0 int._shlFromInteger (dart:core-patch/integers.dart:86:42)
integers.dart:86
#1 int.<< (dart:core-patch/integers.dart:117:49)
integers.dart:117
#2 TileCoordinatesResolver.get (package:flutter_map/src/layer/tile_layer/tile_coordinates.dart:83:22)
tile_coordinates.dart:8In this case, the tile provider API that the app is using sends 512x512 px tiles. As per docs, the app is setting Thanks! |

Fixed the case where zoomOffset is negative.
Couldn't test it properly, e.g. with Retina Tile Layer example.
{Edit] I did manage to reproduce the bug though, by forcing zoomOffset to -1.