X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d3e99bc8bd58533b9432518f8d0573995b8082b9..be931d0955fbd2379b1ffedb9abd32b1e8cb5915:/app/assets/javascripts/leaflet.layers.js
diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js
index b04216d26..7703529b8 100644
--- a/app/assets/javascripts/leaflet.layers.js
+++ b/app/assets/javascripts/leaflet.layers.js
@@ -120,7 +120,7 @@ L.OSM.layers = function(options) {
var list = $('
')
.appendTo(overlaySection);
- function addOverlay(layer, name, minZoom) {
+ function addOverlay(layer, name, maxArea) {
var refName = name.split(' ').join('_').toLowerCase();
var item = $('- ')
.attr('class', refName)
@@ -153,7 +153,7 @@ L.OSM.layers = function(options) {
});
map.on('zoomend', function() {
- var disabled = map.getZoom() < minZoom + 1;
+ var disabled = map.getBounds().getSize() >= maxArea;
$(input).prop('disabled', disabled);
$(item).attr('class', disabled ? 'disabled' : '');
item.attr('data-original-title', disabled ?
@@ -161,8 +161,8 @@ L.OSM.layers = function(options) {
});
}
- addOverlay(map.noteLayer, I18n.t('javascripts.map.layers.notes'), 10);
- addOverlay(map.dataLayer, I18n.t('javascripts.map.layers.data'), 15);
+ addOverlay(map.noteLayer, I18n.t('javascripts.map.layers.notes'), OSM.MAX_NOTE_REQUEST_AREA);
+ addOverlay(map.dataLayer, I18n.t('javascripts.map.layers.data'), OSM.MAX_REQUEST_AREA);
}
options.sidebar.addPane($ui);