You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The TileLayer class has a retinaMode boolean, which when set triggers flutter_maps to request 4 tiles for every 1 and display them at half size, effectively doubling the resolution.
The urlTemplate supports a {r} placeholder, that is always replaced with a '@2x' asking the tile provider to return a tile at double the standard resolution (for example, requesting a 256x256 image, will have a 512x512 returned).
However, these things don't play well together. For example, if flutter_maps needs to fill a 256x256 square on the screen, one of the following three things will happen:
If {r} is in the urlTemplate, the @2x will always be added, regardless of the devices dpi (e.g even if the device only supports 1x, thus details from the image will be lost when displayed).
If retinaMode is set to true, then flutter_maps will fetch 4 squares (at one zoom lower) to make a 512x512 image for this space, and fill that in on the screen, thus simulating it. This only makes sense to do if the device supports dpi > 1x.
If the url contains {r} and retinaMode is set to true, we end up fetching 4 squares at 512x512 each (so total of 1024x1024), and jamming that into the 256x256 space.
Will attempt to both fetch 2x quality images, as well as make four requests for every 1 tile.
Do you have a potential solution?
After discussion on #1666, we think the correct behaviour should be:
TileLayer.retinaMode becomes a enum:
off: don't do anything about retina mode
on: if '{r}' is provided, fill it with '@2x', else simulate it
auto (default): if the device's dpi > 1x then 'on', otherwise use 'off'
and for private testing
simulate: simulate retina mode
Platforms
All
Severity
Minimum: Allows normal functioning
The text was updated successfully, but these errors were encountered:
bramp
added
bug
This issue reports broken functionality or another error
needs triage
This new bug report needs reproducing and prioritizing
labels
Sep 27, 2023
One thing we haven't considered, which is I guess why this wasn't done before, is that we need the BuildContext to whether the device is high DPI. This has huge knock on effects, as the retina mode (simulation now) is used to change some other properties.
What is the bug?
The
TileLayer
class has aretinaMode
boolean, which when set triggers flutter_maps to request 4 tiles for every 1 and display them at half size, effectively doubling the resolution.The
urlTemplate
supports a{r}
placeholder, that is always replaced with a '@2x' asking the tile provider to return a tile at double the standard resolution (for example, requesting a 256x256 image, will have a 512x512 returned).However, these things don't play well together. For example, if flutter_maps needs to fill a 256x256 square on the screen, one of the following three things will happen:
If
{r}
is in theurlTemplate
, the @2x will always be added, regardless of the devices dpi (e.g even if the device only supports 1x, thus details from the image will be lost when displayed).If retinaMode is set to true, then flutter_maps will fetch 4 squares (at one zoom lower) to make a 512x512 image for this space, and fill that in on the screen, thus simulating it. This only makes sense to do if the device supports dpi > 1x.
If the url contains {r} and retinaMode is set to true, we end up fetching 4 squares at 512x512 each (so total of 1024x1024), and jamming that into the 256x256 space.
So # 3 seems wasteful.
How can we reproduce it?
Will attempt to both fetch 2x quality images, as well as make four requests for every 1 tile.
Do you have a potential solution?
After discussion on #1666, we think the correct behaviour should be:
TileLayer.retinaMode becomes a enum:
and for private testing
Platforms
All
Severity
Minimum: Allows normal functioning
The text was updated successfully, but these errors were encountered: