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

(⏸︎) Replace TileLayer.errorImage with TileLayer.tilePlaceholder #1587

Closed

Commits on Aug 3, 2023

  1. Replace TileLayer's error image option with a placeholder image option

    When a tile fails to load and there are no existing loaded tiles which
    overlay with it from another zoom level we are left with a blank portion
    on the map. When there are no loaded tiles visible, for example because
    of a network problem, there is no visual feedback when
    zooming/panning/rotating because the map is just a single solid color.
    This prompted me to add a placeholder image.
    
    We already have an error image implementation but the error image will
    not show up until loading fails which, in the case of a poor network
    connection, can take quite a while.
    
    The placeholder implementation gives visual feedback both whilst loading
    and when loading fails.
    
    Note that the current implementation just fills the viewport with the
    placeholder tile behind all other tiles. It would be more efficient to
    avoid adding placeholder tiles which are completely obscured by other
    visual tiles but my attempts to do this were unsuccessful due to the
    complex nature of tile pruning.
    rorystephenson committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    07ba5bd View commit details
    Browse the repository at this point in the history
  2. Only create placeholder tiles where tiles are missing or not fully tr…

    …ansitioned at the current zoom
    
    This reduces the number of placeholder widgets. The algorithm used to
    determine which coordinates to show placeholders for is a tradeoff
    between speed and the number of redundant placeholders created. It
    creates a placeholder for every tile at the current zoom which failed to
    load or is still transitioning. This means that if a tile from a lower
    zoom obscures the placeholder or multiple tiles from a higher zoom
    collectively obscure the placeholder it will be unnecessarily created.
    It would be possible to avoid this but it would require a more complex
    data structure or iterating all of the tiles for every potential
    placeholder.
    rorystephenson committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    2c44565 View commit details
    Browse the repository at this point in the history
  3. Display tile placeholders by default and use a builder instead of Ima…

    …geProvider for placeholders.
    rorystephenson committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    1c87fcc View commit details
    Browse the repository at this point in the history
  4. Simplify placeholder creation

    Now that placeholder is a widget instead of an ImageProvider we can
    simplify the construction by making it a CustomPaint.
    rorystephenson committed Aug 3, 2023
    Configuration menu
    Copy the full SHA
    6bb5588 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    88cabd8 View commit details
    Browse the repository at this point in the history