Move zoomPrecision function to the OSM namespace
This commit is contained in:
parent
665abc501c
commit
66039dedb0
6 changed files with 9 additions and 9 deletions
|
@ -20,10 +20,6 @@
|
|||
|
||||
var querystring = require('querystring-component');
|
||||
|
||||
function zoomPrecision(zoom) {
|
||||
return Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
|
||||
}
|
||||
|
||||
function remoteEditHandler(bbox, object) {
|
||||
var loaded = false,
|
||||
query = {
|
||||
|
|
|
@ -333,7 +333,7 @@ $(document).ready(function () {
|
|||
|
||||
$(".describe_location").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var precision = zoomPrecision(map.getZoom());
|
||||
var precision = OSM.zoomPrecision(map.getZoom());
|
||||
OSM.router.route("/search?query=" + encodeURIComponent(
|
||||
map.getCenter().lat.toFixed(precision) + "," +
|
||||
map.getCenter().lng.toFixed(precision)));
|
||||
|
|
|
@ -36,7 +36,7 @@ OSM.Export = function(map) {
|
|||
}
|
||||
|
||||
function setBounds(bounds) {
|
||||
var precision = zoomPrecision(map.getZoom());
|
||||
var precision = OSM.zoomPrecision(map.getZoom());
|
||||
$("#minlon").val(bounds.getWest().toFixed(precision));
|
||||
$("#minlat").val(bounds.getSouth().toFixed(precision));
|
||||
$("#maxlon").val(bounds.getEast().toFixed(precision));
|
||||
|
|
|
@ -91,7 +91,7 @@ L.OSM.Map = L.Map.extend({
|
|||
},
|
||||
|
||||
getUrl: function(marker) {
|
||||
var precision = zoomPrecision(this.getZoom()),
|
||||
var precision = OSM.zoomPrecision(this.getZoom()),
|
||||
params = {};
|
||||
|
||||
if (marker && this.hasLayer(marker)) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ $(document).ready(function () {
|
|||
map.on("click", function (e) {
|
||||
if ($('#updatehome').is(':checked')) {
|
||||
var zoom = map.getZoom(),
|
||||
precision = zoomPrecision(zoom),
|
||||
precision = OSM.zoomPrecision(zoom),
|
||||
location = e.latlng.wrap();
|
||||
|
||||
$('#homerow').removeClass();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue