X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/439ad373ec5ee364003625e56159b1dce5fb186e..be931d0955fbd2379b1ffedb9abd32b1e8cb5915:/app/assets/javascripts/leaflet.layers.js
diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js
index 2d28c256c..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,16 +153,16 @@ 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);
- disabled ? $(item).attr('class', 'disabled') : $(item).attr('class', '');
+ $(item).attr('class', disabled ? 'disabled' : '');
item.attr('data-original-title', disabled ?
- 'Zoom in to see ' + name.toLowerCase() : '');
+ I18n.t('javascripts.site.' + refName + '_zoom_in_tooltip') : '');
});
}
- 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);
@@ -171,6 +171,7 @@ L.OSM.layers = function(options) {
e.stopPropagation();
e.preventDefault();
options.sidebar.togglePane($ui, button);
+ $('.leaflet-control .control-button').tooltip('hide');
}
return $container[0];