Move zoomPrecision function to the OSM namespace

This commit is contained in:
Tom Hughes 2014-02-27 18:15:54 +00:00
parent 665abc501c
commit 66039dedb0
6 changed files with 9 additions and 9 deletions

View file

@ -153,7 +153,7 @@ OSM = {
center = center.wrap();
layers = layers.replace('M', '');
var precision = zoomPrecision(zoom),
var precision = OSM.zoomPrecision(zoom),
hash = '#map=' + zoom +
'/' + center.lat.toFixed(precision) +
'/' + center.lng.toFixed(precision);
@ -163,5 +163,9 @@ OSM = {
}
return hash;
},
zoomPrecision: function (zoom) {
return Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
}
};