Fix gray tiles when tile image is already avaible#715
Merged
johnpryan merged 3 commits intofleaflet:masterfrom Aug 4, 2020
Merged
Fix gray tiles when tile image is already avaible#715johnpryan merged 3 commits intofleaflet:masterfrom
johnpryan merged 3 commits intofleaflet:masterfrom
Conversation
Contributor
Author
|
How to test, just change |
This was referenced Aug 4, 2020
johnpryan
reviewed
Aug 4, 2020
| tileReady: _tileReady, | ||
| ); | ||
|
|
||
| tile.loadTileImage(); |
Collaborator
There was a problem hiding this comment.
(nitpick) This code could use the cascade operator to simplify:
_tiles[tileCoordsToKey] = Tile(
// ...
)..loadTileImage();
Contributor
Author
There was a problem hiding this comment.
I tried it but didn't work. I'll give it another try maybe hotreload bugged.
Contributor
Author
There was a problem hiding this comment.
I retried it didn't work. I think this happens under hood when cascade operator is used.
- Tile object created
loadTileImagemethod called on Tile- Tile added to
_tiles[tileCoordsToKey]
With temp variable this happens:
- Tile object created
- Tile added to
_tiles[tileCoordsToKey] loadTileImagemethod called on Tile
So even if loadTileImage's callback is synchronous we are sure it is already in _tiles map.
johnpryan
approved these changes
Aug 4, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello, this PR make sure the
loadTileImage's listeners runs after thetileis in_tilesmap .Since this code:
skipped fade-in part, the tiles remained gray. This only happaned if
image objectwas in phone's ram so there wasn't an async callback sinceimagewas instantly avaible, however this fix doesn't assumeasync image loadanymore.closes #707
closes #713
closes #636
closes #608