")
.appendTo(item);
- 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.whenReady(function () {
+ var miniMap = L.map(div[0], { attributionControl: false, zoomControl: false, keyboard: false })
+ .addLayer(new layer.constructor({ apikey: layer.options.apikey }));
miniMap.dragging.disable();
miniMap.touchZoom.disable();
miniMap.doubleClickZoom.disable();
miniMap.scrollWheelZoom.disable();
- map.on('moveend', function() {
- miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0));
- });
+ $ui
+ .on("show", shown)
+ .on("hide", hide);
+
+ function shown() {
+ miniMap.invalidateSize();
+ setView({ animate: false });
+ map.on("moveend", moved);
+ }
+
+ function hide() {
+ map.off("moveend", moved);
+ }
- div.data('map', miniMap);
+ function moved() {
+ setView();
+ }
+
+ function setView(options) {
+ miniMap.setView(map.getCenter(), Math.max(map.getZoom() - 2, 0), options);
+ }
});
- var label = $('