')
.appendTo(list);
- if (this._map.hasLayer(layer)) {
+ if (map.hasLayer(layer)) {
item.addClass('active');
}
- var div = $('')
+ var div = $('')
.appendTo(item);
- 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))
+ map.whenReady(function() {
+ var miniMap = L.map(div[0], {attributionControl: false, zoomControl: false})
+ .setView(map.getCenter(), Math.max(map.getZoom() - 2, 0))
.addLayer(new layer.constructor);
- map.dragging.disable();
- map.touchZoom.disable();
- map.doubleClickZoom.disable();
- map.scrollWheelZoom.disable();
- }, this);
+ miniMap.dragging.disable();
+ miniMap.touchZoom.disable();
+ miniMap.doubleClickZoom.disable();
+ miniMap.scrollWheelZoom.disable();
- var label = $('')
+ map.on('moveend', function() {
+ miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0));
+ });
+
+ div.data('map', miniMap);
+ });
+
+ var label = $('