From 1951ed2eb8af93d71e4d10ce0ede81d3ee2090bd Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Fri, 16 Aug 2024 10:45:54 +0300 Subject: [PATCH] Change zoom precision function This changes the number of fractional digits to log10(pixels / degrees) with pixels = 2**(8 + zoom) and degrees = 180. --- app/assets/javascripts/osm.js.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/osm.js.erb b/app/assets/javascripts/osm.js.erb index e429f4479..e08528f84 100644 --- a/app/assets/javascripts/osm.js.erb +++ b/app/assets/javascripts/osm.js.erb @@ -204,7 +204,9 @@ OSM = { }, 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) { -- 2.39.5