')
+ .appendTo(item);
- _initLayout: function () {
- var className = 'leaflet-control-map-ui',
- container = this._container = L.DomUtil.create('div', className);
+ map.whenReady(function() {
+ var miniMap = L.map(div[0], {attributionControl: false, zoomControl: false})
+ .addLayer(new layer.constructor());
- var link = L.DomUtil.create('a', 'control-button', container);
- link.innerHTML = "
";
- link.href = '#';
- link.title = 'Layers';
+ miniMap.dragging.disable();
+ miniMap.touchZoom.disable();
+ miniMap.doubleClickZoom.disable();
+ miniMap.scrollWheelZoom.disable();
- this._ui = $(L.DomUtil.create('div', 'layers-ui', this.options.uiPane))
- .html(JST["templates/map/layers"]());
+ $ui
+ .on('show', shown)
+ .on('hide', hide);
- var list = this._ui.find('.base-layers ul');
+ function shown() {
+ miniMap.invalidateSize();
+ setView({animate: false});
+ map.on('moveend', moved);
+ }
- this.options.layers.forEach(function(layer) {
- var item = $('
')
- .appendTo(list);
+ function hide() {
+ map.off('moveend', moved);
+ }
- if (this._map.hasLayer(layer)) {
- item.addClass('active');
- }
+ function moved() {
+ setView();
+ }
- var div = $('
')
- .appendTo(item);
+ function setView(options) {
+ miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0), options);
+ }
+ });
- this._map.whenReady(function() {
- var map = L.map(div[0], {attributionControl: false, zoomControl: false})
- .setView(this._map.getCenter(), Math.max(this._map.getZoom() - 2, 0))
- .addLayer(new layer.constructor);
+ var label = $('