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