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
Currently it is possible to tell Leaflet to serve tiles of specific resolution by computing it from window.devicePixelRatio and inserting it to TileLayer URL (see #6449 (comment)).
It would be nice to be able to provide list of additional supported scales (eg. [2, 3] for 2x and 3x ) and tiles represented by imgs would then use srcset attribute to tell browser which image to fetch depending on device resolution.
For an example you can see the implementation using react-leaflet in ScaledTileLayer.tsx that extends TileLayer and trivially adds srcset to img returned by createTile. The result can be seen at https://www.freemap.sk/?map=15/48.855595/20.941937&layers=X - view it on HDPI device (eg. mobile phone) or zoom the page in Firefox (Ctrl + +).
The text was updated successfully, but these errors were encountered:
Currently it is possible to tell Leaflet to serve tiles of specific resolution by computing it from
window.devicePixelRatio
and inserting it to TileLayer URL (see #6449 (comment)).It would be nice to be able to provide list of additional supported scales (eg. [2, 3] for 2x and 3x ) and tiles represented by
img
s would then usesrcset
attribute to tell browser which image to fetch depending on device resolution.For an example you can see the implementation using react-leaflet in ScaledTileLayer.tsx that extends TileLayer and trivially adds
srcset
toimg
returned bycreateTile
. The result can be seen at https://www.freemap.sk/?map=15/48.855595/20.941937&layers=X - view it on HDPI device (eg. mobile phone) or zoom the page in Firefox (Ctrl
++
).The text was updated successfully, but these errors were encountered: