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

Tiles not appearing when using FlutterMap on multiple screens #707

Closed
maro242 opened this issue Aug 2, 2020 · 2 comments · Fixed by #715
Closed

Tiles not appearing when using FlutterMap on multiple screens #707

maro242 opened this issue Aug 2, 2020 · 2 comments · Fixed by #715

Comments

@maro242
Copy link

maro242 commented Aug 2, 2020

Steps to reproduce:

  1. Create two screens with FlutterMap (both maps should have identical center and zoom). Alternatively, you can run this example.
  2. Navigate from the first screen to the other.
  3. Tiles displayed on the first screen never appear on the second one.
  4. Panning in any direction will show tiles but the original area will remain unloaded.

This used to work on 0.8.2 but does not work since the changes to tile management on 0.9.0.

Removing the indicated line (965) from the _tileReady method in tile_layer.dart solves the issue.

var key = _tileCoordsToKey(coords);
tile = _tiles[key]; //Removing this solves the issue
if (null == tile) {
  return;
}

I do not understand the package enough to know what purpose does keeping tiles in the _tiles hash map serve but so far I have not noticed any issues since deleting it so am quite curious about this.

@maRci002
Copy link
Contributor

maRci002 commented Aug 4, 2020

var key = _tileCoordsToKey(coords);
tile = _tiles[key];
if (null == tile) {
  return;
}

Makes sure the loaded tile is still in _tiles HashMap which is maintained mainly by void _update(LatLng center) { and void _pruneTiles() { and void _abortLoading() { methods. Imagine a situation where you start loading 4 tiles forexample the center of a country, then you move the map to the country's boundary then the center tiles finished with loading so we are no more intersted of center tiles anymore. Anyway in #572 I implemented this behaviour from Leafet.

You are right about the problem so I'll investigate it.

@maRci002
Copy link
Contributor

maRci002 commented Aug 4, 2020

Try PR #715 it should fix your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants