')
.addClass('overlay-layers')
- .appendTo(this.$ui);
+ .appendTo($ui);
$('')
.text(I18n.t('javascripts.map.layers.overlays'))
@@ -72,7 +68,7 @@ L.OSM.Layers = L.Control.extend({
var baseSection = $('')
.addClass('base-layers')
- .appendTo(this.$ui);
+ .appendTo($ui);
$('')
.text(I18n.t('javascripts.map.layers.base'))
@@ -128,29 +124,27 @@ L.OSM.Layers = L.Control.extend({
});
});
- $(link).on('click', $.proxy(this.toggleLayers, this));
- },
+ function toggle(e) {
+ e.stopPropagation();
+ e.preventDefault();
- toggleLayers: function (e) {
- e.stopPropagation();
- e.preventDefault();
+ var controlContainer = $('.leaflet-control-container .leaflet-top.leaflet-right');
- var controlContainer = $('.leaflet-control-container .leaflet-top.leaflet-right');
+ if ($ui.is(':visible')) {
+ $(control.options.uiPane).hide();
+ controlContainer.css({paddingRight: '0'});
+ } else {
+ $(control.options.uiPane).show();
+ controlContainer.css({paddingRight: '230px'});
+ }
- if (this.$ui.is(':visible')) {
- $(this.options.uiPane).hide();
- controlContainer.css({paddingRight: '0'});
- } else {
- $(this.options.uiPane).show();
- controlContainer.css({paddingRight: '230px'});
+ $ui.find('.base-layers .leaflet-container').each(function() {
+ $(this).data('map').invalidateSize();
+ });
}
- this.$ui.find('.base-layers .leaflet-container').each(function() {
- $(this).data('map').invalidateSize();
- });
- }
-});
+ return $container[0];
+ };
-L.OSM.layers = function(options) {
- return new L.OSM.Layers(options);
+ return control;
};