Change zoom precision function

This changes the number of fractional digits to log10(pixels / degrees) with pixels = 2**(8 + zoom) and degrees = 180.
This commit is contained in:
Anton Khorev 2024-08-16 10:45:54 +03:00
parent 9b2db63a95
commit 1951ed2eb8

View file

@ -204,7 +204,9 @@ OSM = {
}, },
zoomPrecision: function(zoom) { zoomPrecision: function(zoom) {
return Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)); var pixels = Math.pow(2, 8 + zoom);
var degrees = 180;
return Math.ceil(Math.log10(pixels / degrees));
}, },
locationCookie: function(map) { locationCookie: function(map) {