update old clustering library (and others)

to address #93
This commit is contained in:
Dave Conway-Jones 2019-04-27 09:18:24 +01:00
parent 126041ed60
commit 6687c08e3c
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
10 changed files with 89 additions and 336 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap
- v2.0.5-beta - Fix clustering on zoom (update old library)
- v2.0.4-beta - Add helicopter icon. Correct Leaflet.Coordinates file name. Fix right contextmenu.
- v2.0.3-beta - Let circles have popups. Better drawing of ellipses
- v2.0.2-beta - Let lines and areas also have popups

View File

@ -9,6 +9,7 @@ map web page for plotting "things" on.
### Updates
- v2.0.5-beta - Fix clustering on zoom (update old library)
- v2.0.4-beta - Add helicopter icon. Correct Leaflet.Coordinates file name. Fix right contextmenu.
- v2.0.3-beta - Let circles have popups. Better drawing of ellipses
- v2.0.2-beta - Let lines and areas also have popups

View File

@ -43,7 +43,7 @@
<script src="leaflet/leaflet-vector-markers.min.js"></script>
<script src="leaflet/leaflet.boatmarker.js"></script>
<script src="leaflet/leaflet.markercluster.js"></script>
<script src="leaflet/leaflet.markercluster.freezable-src.js"></script>
<script src="leaflet/leaflet.markercluster.freezable.js"></script>
<script src="leaflet/leaflet.active-layers.min.js"></script>
<script src="leaflet/leaflet.select-layers.min.js"></script>
<script src="leaflet/leaflet.draw.js"></script>

View File

@ -1 +1 @@
(function(factory){var L;if(typeof define==="function"&&define.amd){define(["leaflet"],factory)}else if(typeof module!=="undefined"){L=require("leaflet");module.exports=factory(L)}else{if(typeof window.L==="undefined"){throw new Error("Leaflet must be loaded first")}factory(window.L)}})(function(L){L.Control.Fullscreen=L.Control.extend({options:{position:"topleft",title:{"false":"View Fullscreen","true":"Exit Fullscreen"}},onAdd:function(map){var container=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",container);this.link.href="#";this._map=map;this._map.on("fullscreenchange",this._toggleTitle,this);this._toggleTitle();L.DomEvent.on(this.link,"click",this._click,this);return container},_click:function(e){L.DomEvent.stopPropagation(e);L.DomEvent.preventDefault(e);this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||false},toggleFullscreen:function(options){var container=this.getContainer();if(this.isFullscreen()){if(options&&options.pseudoFullscreen){this._disablePseudoFullscreen(container)}else if(document.exitFullscreen){document.exitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}else{this._disablePseudoFullscreen(container)}}else{if(options&&options.pseudoFullscreen){this._enablePseudoFullscreen(container)}else if(container.requestFullscreen){container.requestFullscreen()}else if(container.mozRequestFullScreen){container.mozRequestFullScreen()}else if(container.webkitRequestFullscreen){container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}else if(container.msRequestFullscreen){container.msRequestFullscreen()}else{this._enablePseudoFullscreen(container)}}},_enablePseudoFullscreen:function(container){L.DomUtil.addClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(true);this.fire("fullscreenchange")},_disablePseudoFullscreen:function(container){L.DomUtil.removeClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(false);this.fire("fullscreenchange")},_setFullscreen:function(fullscreen){this._isFullscreen=fullscreen;var container=this.getContainer();if(fullscreen){L.DomUtil.addClass(container,"leaflet-fullscreen-on")}else{L.DomUtil.removeClass(container,"leaflet-fullscreen-on")}this.invalidateSize()},_onFullscreenChange:function(e){var fullscreenElement=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;if(fullscreenElement===this.getContainer()&&!this._isFullscreen){this._setFullscreen(true);this.fire("fullscreenchange")}else if(fullscreenElement!==this.getContainer()&&this._isFullscreen){this._setFullscreen(false);this.fire("fullscreenchange")}}});L.Map.mergeOptions({fullscreenControl:false});L.Map.addInitHook(function(){if(this.options.fullscreenControl){this.fullscreenControl=new L.Control.Fullscreen(this.options.fullscreenControl);this.addControl(this.fullscreenControl)}var fullscreenchange;if("onfullscreenchange"in document){fullscreenchange="fullscreenchange"}else if("onmozfullscreenchange"in document){fullscreenchange="mozfullscreenchange"}else if("onwebkitfullscreenchange"in document){fullscreenchange="webkitfullscreenchange"}else if("onmsfullscreenchange"in document){fullscreenchange="MSFullscreenChange"}if(fullscreenchange){var onFullscreenChange=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,fullscreenchange,onFullscreenChange)});this.on("unload",function(){L.DomEvent.off(document,fullscreenchange,onFullscreenChange)})}});L.control.fullscreen=function(options){return new L.Control.Fullscreen(options)}});
(function(factory){var L;if(typeof define==="function"&&define.amd){define(["leaflet"],factory)}else if(typeof module!=="undefined"){L=require("leaflet");module.exports=factory(L)}else{if(typeof window.L==="undefined"){throw new Error("Leaflet must be loaded first")}factory(window.L)}})(function(L){L.Control.Fullscreen=L.Control.extend({options:{position:"topleft",title:{"false":"View Fullscreen","true":"Exit Fullscreen"}},onAdd:function(map){var container=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",container);this.link.href="#";this._map=map;this._map.on("fullscreenchange",this._toggleTitle,this);this._toggleTitle();L.DomEvent.on(this.link,"click",this._click,this);return container},_click:function(e){L.DomEvent.stopPropagation(e);L.DomEvent.preventDefault(e);this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||false},toggleFullscreen:function(options){var container=this.getContainer();if(this.isFullscreen()){if(options&&options.pseudoFullscreen){this._disablePseudoFullscreen(container)}else if(document.exitFullscreen){document.exitFullscreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}else if(document.msExitFullscreen){document.msExitFullscreen()}else{this._disablePseudoFullscreen(container)}}else{if(options&&options.pseudoFullscreen){this._enablePseudoFullscreen(container)}else if(container.requestFullscreen){container.requestFullscreen()}else if(container.mozRequestFullScreen){container.mozRequestFullScreen()}else if(container.webkitRequestFullscreen){container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}else if(container.msRequestFullscreen){container.msRequestFullscreen()}else{this._enablePseudoFullscreen(container)}}},_enablePseudoFullscreen:function(container){L.DomUtil.addClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(true);this.fire("fullscreenchange")},_disablePseudoFullscreen:function(container){L.DomUtil.removeClass(container,"leaflet-pseudo-fullscreen");this._setFullscreen(false);this.fire("fullscreenchange")},_setFullscreen:function(fullscreen){this._isFullscreen=fullscreen;var container=this.getContainer();if(fullscreen){L.DomUtil.addClass(container,"leaflet-fullscreen-on")}else{L.DomUtil.removeClass(container,"leaflet-fullscreen-on")}this.invalidateSize()},_onFullscreenChange:function(e){var fullscreenElement=document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement;if(fullscreenElement===this.getContainer()&&!this._isFullscreen){this._setFullscreen(true);this.fire("fullscreenchange")}else if(fullscreenElement!==this.getContainer()&&this._isFullscreen){this._setFullscreen(false);this.fire("fullscreenchange")}}});L.Map.mergeOptions({fullscreenControl:false});L.Map.addInitHook(function(){if(this.options.fullscreenControl){this.fullscreenControl=new L.Control.Fullscreen(this.options.fullscreenControl);this.addControl(this.fullscreenControl)}var fullscreenchange;if("onfullscreenchange"in document){fullscreenchange="fullscreenchange"}else if("onmozfullscreenchange"in document){fullscreenchange="mozfullscreenchange"}else if("onwebkitfullscreenchange"in document){fullscreenchange="webkitfullscreenchange"}else if("onmsfullscreenchange"in document){fullscreenchange="MSFullscreenChange"}if(fullscreenchange){var onFullscreenChange=L.bind(this._onFullscreenChange,this);this.whenReady(function(){L.DomEvent.on(document,fullscreenchange,onFullscreenChange)});this.on("unload",function(){L.DomEvent.off(document,fullscreenchange,onFullscreenChange)})}});L.control.fullscreen=function(options){return new L.Control.Fullscreen(options)}});

View File

@ -1,60 +1,60 @@
.marker-cluster-small {
background-color: rgba(181, 226, 140, 0.6);
}
.marker-cluster-small div {
background-color: rgba(110, 204, 57, 0.6);
}
.marker-cluster-medium {
background-color: rgba(241, 211, 87, 0.6);
}
.marker-cluster-medium div {
background-color: rgba(240, 194, 12, 0.6);
}
.marker-cluster-large {
background-color: rgba(253, 156, 115, 0.6);
}
.marker-cluster-large div {
background-color: rgba(241, 128, 23, 0.6);
}
/* IE 6-8 fallback colors */
.leaflet-oldie .marker-cluster-small {
background-color: rgb(181, 226, 140);
}
.leaflet-oldie .marker-cluster-small div {
background-color: rgb(110, 204, 57);
}
.leaflet-oldie .marker-cluster-medium {
background-color: rgb(241, 211, 87);
}
.leaflet-oldie .marker-cluster-medium div {
background-color: rgb(240, 194, 12);
}
.leaflet-oldie .marker-cluster-large {
background-color: rgb(253, 156, 115);
}
.leaflet-oldie .marker-cluster-large div {
background-color: rgb(241, 128, 23);
}
.marker-cluster {
background-clip: padding-box;
border-radius: 20px;
}
.marker-cluster div {
width: 30px;
height: 30px;
margin-left: 5px;
margin-top: 5px;
text-align: center;
border-radius: 15px;
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
}
.marker-cluster span {
line-height: 30px;
.marker-cluster-small {
background-color: rgba(181, 226, 140, 0.6);
}
.marker-cluster-small div {
background-color: rgba(110, 204, 57, 0.6);
}
.marker-cluster-medium {
background-color: rgba(241, 211, 87, 0.6);
}
.marker-cluster-medium div {
background-color: rgba(240, 194, 12, 0.6);
}
.marker-cluster-large {
background-color: rgba(253, 156, 115, 0.6);
}
.marker-cluster-large div {
background-color: rgba(241, 128, 23, 0.6);
}
/* IE 6-8 fallback colors */
.leaflet-oldie .marker-cluster-small {
background-color: rgb(181, 226, 140);
}
.leaflet-oldie .marker-cluster-small div {
background-color: rgb(110, 204, 57);
}
.leaflet-oldie .marker-cluster-medium {
background-color: rgb(241, 211, 87);
}
.leaflet-oldie .marker-cluster-medium div {
background-color: rgb(240, 194, 12);
}
.leaflet-oldie .marker-cluster-large {
background-color: rgb(253, 156, 115);
}
.leaflet-oldie .marker-cluster-large div {
background-color: rgb(241, 128, 23);
}
.marker-cluster {
background-clip: padding-box;
border-radius: 20px;
}
.marker-cluster div {
width: 30px;
height: 30px;
margin-left: 5px;
margin-top: 5px;
text-align: center;
border-radius: 15px;
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
}
.marker-cluster span {
line-height: 30px;
}

View File

@ -1,14 +1,14 @@
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}
.leaflet-cluster-spider-leg {
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;
-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;
transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
}
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}
.leaflet-cluster-spider-leg {
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;
-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;
transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
}

View File

@ -1,252 +0,0 @@
/**
* Leaflet.MarkerCluster.Freezable sub-plugin for Leaflet.markercluster plugin.
* Adds the ability to freeze clusters at a specified zoom.
* Copyright (c) 2015 Boris Seang
* Distributed under the MIT License (Expat type)
*/
// UMD
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['leaflet'], function (L) {
return (root.L.MarkerClusterGroup = factory(L));
});
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require('leaflet'));
} else {
// Browser globals
root.L.MarkerClusterGroup = factory(root.L);
}
}(this, function (L, undefined) { // Does not actually expect the 'undefined' argument, it is just a trick to have an undefined variable.
var LMCG = L.MarkerClusterGroup,
LMCGproto = LMCG.prototype;
LMCG.freezableVersion = '0.1.0';
LMCG.include({
_originalOnAdd: LMCGproto.onAdd,
onAdd: function (map) {
var frozenZoom = this._zoom;
this._originalOnAdd(map);
if (this._frozen) {
// Restore the specified frozenZoom if necessary.
if (frozenZoom >= 0 && frozenZoom !== this._zoom) {
// Undo clusters and markers addition to this._featureGroup.
this._featureGroup.clearLayers();
this._zoom = frozenZoom;
this.addLayers([]);
}
// Replace the callbacks on zoomend and moveend events.
map.off('zoomend', this._zoomEnd, this);
map.off('moveend', this._moveEnd, this);
map.on('zoomend moveend', this._viewChangeEndNotClustering, this);
}
},
_originalOnRemove: LMCGproto.onRemove,
onRemove: function (map) {
map.off('zoomend moveend', this._viewChangeEndNotClustering, this);
this._originalOnRemove(map);
},
disableClustering: function () {
return this.freezeAtZoom(this._maxZoom + 1);
},
disableClusteringKeepSpiderfy: function () {
return this.freezeAtZoom(this._maxZoom);
},
enableClustering: function () {
return this.unfreeze();
},
unfreeze: function () {
return this.freezeAtZoom(false);
},
freezeAtZoom: function (frozenZoom) {
this._processQueue();
var map = this._map;
// If frozenZoom is not specified, true or NaN, freeze at current zoom.
// Note: NaN is the only value which is not eaqual to itself.
if (frozenZoom === undefined || frozenZoom === true || (frozenZoom !== frozenZoom)) {
// Set to -1 if not on map, as the sign to freeze as soon as it gets added to a map.
frozenZoom = map ? Math.round(map.getZoom()) : -1;
} else if (frozenZoom === 'max') {
// If frozenZoom is "max", freeze at MCG maxZoom + 1 (eliminates all clusters).
frozenZoom = this._maxZoom + 1;
} else if (frozenZoom === 'maxKeepSpiderfy') {
// If "maxKeepSpiderfy", freeze at MCG maxZoom (eliminates all clusters but bottom-most ones).
frozenZoom = this._maxZoom;
}
var requestFreezing = typeof frozenZoom === 'number';
if (this._frozen) { // Already frozen.
if (!requestFreezing) { // Unfreeze.
this._unfreeze();
return this;
}
// Just change the frozen zoom: go straight to artificial zoom.
} else if (requestFreezing) {
// Start freezing
this._initiateFreeze();
} else { // Not frozen and not requesting freezing => nothing to do.
return this;
}
this._artificialZoomSafe(this._zoom, frozenZoom);
return this;
},
_initiateFreeze: function () {
var map = this._map;
// Start freezing
this._frozen = true;
if (map) {
// Change behaviour on zoomEnd and moveEnd.
map.off('zoomend', this._zoomEnd, this);
map.off('moveend', this._moveEnd, this);
map.on('zoomend moveend', this._viewChangeEndNotClustering, this);
}
},
_unfreeze: function () {
var map = this._map;
this._frozen = false;
if (map) {
// Restore original behaviour on zoomEnd.
map.off('zoomend moveend', this._viewChangeEndNotClustering, this);
map.on('zoomend', this._zoomEnd, this);
map.on('moveend', this._moveEnd, this);
// Animate.
this._executeAfterUnspiderfy(function () {
this._zoomEnd(); // Will set this._zoom at the end.
}, this);
}
},
_executeAfterUnspiderfy: function (callback, context) {
// Take care of spiderfied markers!
// The cluster might be removed, whereas markers are on fake positions.
if (this._unspiderfy && this._spiderfied) {
this.once('animationend', function () {
callback.call(context);
});
this._unspiderfy();
return;
}
callback.call(context);
},
_artificialZoomSafe: function (previousZoom, targetZoom) {
this._zoom = targetZoom;
if (!this._map || previousZoom === targetZoom) {
return;
}
this._executeAfterUnspiderfy(function () {
this._artificialZoom(previousZoom, targetZoom);
}, this);
},
_artificialZoom: function (previousZoom, targetZoom) {
if (previousZoom < targetZoom) {
// Make as if we had instantly zoomed in from previousZoom to targetZoom.
this._animationStart();
this._topClusterLevel._recursivelyRemoveChildrenFromMap(
this._currentShownBounds, previousZoom, this._getExpandedVisibleBounds()
);
this._animationZoomIn(previousZoom, targetZoom);
} else if (previousZoom > targetZoom) {
// Make as if we had instantly zoomed out from previousZoom to targetZoom.
this._animationStart();
this._animationZoomOut(previousZoom, targetZoom);
}
},
_viewChangeEndNotClustering: function () {
var fg = this._featureGroup,
newBounds = this._getExpandedVisibleBounds(),
targetZoom = this._zoom;
// Remove markers and bottom clusters outside newBounds, unless they come
// from a spiderfied cluster.
fg.eachLayer(function (layer) {
if (!newBounds.contains(layer._latlng) && layer.__parent && layer.__parent._zoom < targetZoom) {
fg.removeLayer(layer);
}
});
// Add markers and bottom clusters in newBounds.
this._topClusterLevel._recursively(newBounds, -1, targetZoom,
function (c) { // Add markers from each cluster of lower zoom than targetZoom
if (c._zoom === targetZoom) { // except targetZoom
return;
}
var markers = c._markers,
i = 0,
marker;
for (; i < markers.length; i++) {
marker = c._markers[i];
if (!newBounds.contains(marker._latlng)) {
continue;
}
fg.addLayer(marker);
}
},
function (c) { // Add clusters from targetZoom.
c._addToMap();
}
);
},
_originalZoomOrSpiderfy: LMCGproto._zoomOrSpiderfy,
_zoomOrSpiderfy: function (e) {
if (this._frozen && this.options.spiderfyOnMaxZoom) {
e.layer.spiderfy();
if (e.originalEvent && e.originalEvent.keyCode === 13) {
map._container.focus();
}
} else {
this._originalZoomOrSpiderfy(e);
}
}
});
// Just return a value to define the module export.
return LMCG;
}));

View File

@ -0,0 +1,6 @@
/*!
Leaflet.MarkerCluster.Freezable 1.0.0+9db80a3
(c) 2015-2016 Boris Seang
License MIT
*/
!function(e,i){"function"==typeof define&&define.amd?define(["leaflet"],i):i("object"==typeof module&&module.exports?require("leaflet"):e.L)}(this,function(e,i){e.MarkerClusterGroup.include({_originalOnAddFreezable:e.MarkerClusterGroup.prototype.onAdd,onAdd:function(e){var i=this._zoom;this._originalOnAddFreezable(e),this._frozen&&(i>=0&&i!==this._zoom&&(this._featureGroup.clearLayers(),this._zoom=i,this.addLayers([])),e.off("zoomend",this._zoomEnd,this),e.off("moveend",this._moveEnd,this),e.on("zoomend moveend",this._viewChangeEndNotClustering,this))},_originalOnRemove:e.MarkerClusterGroup.prototype.onRemove,onRemove:function(e){e.off("zoomend moveend",this._viewChangeEndNotClustering,this),this._originalOnRemove(e)},disableClustering:function(){return this.freezeAtZoom(this._maxZoom+1)},disableClusteringKeepSpiderfy:function(){return this.freezeAtZoom(this._maxZoom)},enableClustering:function(){return this.unfreeze()},unfreeze:function(){return this.freezeAtZoom(!1)},freezeAtZoom:function(e){this._processQueue();var o=this._map;e===i||e===!0||e!==e?e=o?Math.round(o.getZoom()):-1:"max"===e?e=this._maxZoom+1:"maxKeepSpiderfy"===e&&(e=this._maxZoom);var t="number"==typeof e;if(this._frozen){if(!t)return this._unfreeze(),this}else{if(!t)return this;this._initiateFreeze()}return this._artificialZoomSafe(this._zoom,e),this},_initiateFreeze:function(){var e=this._map;this._frozen=!0,e&&(e.off("zoomend",this._zoomEnd,this),e.off("moveend",this._moveEnd,this),e.on("zoomend moveend",this._viewChangeEndNotClustering,this))},_unfreeze:function(){var e=this._map;this._frozen=!1,e&&(e.off("zoomend moveend",this._viewChangeEndNotClustering,this),e.on("zoomend",this._zoomEnd,this),e.on("moveend",this._moveEnd,this),this._executeAfterUnspiderfy(function(){this._zoomEnd()},this))},_executeAfterUnspiderfy:function(e,i){return this._unspiderfy&&this._spiderfied?(this.once("animationend",function(){e.call(i)}),void this._unspiderfy()):void e.call(i)},_artificialZoomSafe:function(e,i){this._zoom=i,this._map&&e!==i&&this._executeAfterUnspiderfy(function(){this._artificialZoom(e,i)},this)},_artificialZoom:function(e,i){e<i?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,this._map.getMinZoom(),e,this._getExpandedVisibleBounds()),this._animationZoomIn(e,i)):e>i&&(this._animationStart(),this._animationZoomOut(e,i))},_viewChangeEndNotClustering:function(){var e=this._featureGroup,i=this._getExpandedVisibleBounds(),o=this._zoom;e.eachLayer(function(t){!i.contains(t._latlng)&&t.__parent&&t.__parent._zoom<o&&e.removeLayer(t)}),this._topClusterLevel._recursively(i,-1,o,function(t){if(t._zoom!==o)for(var n,r=t._markers,s=0;s<r.length;s++)n=t._markers[s],i.contains(n._latlng)&&e.addLayer(n)},function(e){e._addToMap()}),this._currentShownBounds=i},_originalZoomOrSpiderfy:e.MarkerClusterGroup.prototype._zoomOrSpiderfy,_zoomOrSpiderfy:function(e){this._frozen&&this.options.spiderfyOnMaxZoom?(e.layer.spiderfy(),e.originalEvent&&13===e.originalEvent.keyCode&&map._container.focus()):this._originalZoomOrSpiderfy(e)}})});

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*!
SelectLayersControl - v0.2.2 - 2014-10-10
leaflet.select-layers - v0.3.0 - 2015-08-05
https://github.com/vogdb/SelectLayersControl.git
Copyright (c) 2014 Sanin Aleksey aka vogdb; Licensed MIT
Copyright (c) 2015 Sanin Aleksey aka vogdb; Licensed MIT
*/
L.Control.SelectLayers=L.Control.ActiveLayers.extend({_initLayout:function(){var a="leaflet-control-layers",b=this._container=L.DomUtil.create("div",a);L.DomEvent.disableClickPropagation(b),L.Browser.touch?L.DomEvent.on(b,"click",L.DomEvent.stopPropagation):L.DomEvent.on(b,"mousewheel",L.DomEvent.stopPropagation);var c=this._form=L.DomUtil.create("form",a+"-list");if(this.options.collapsed){var d=this._layersLink=L.DomUtil.create("a",a+"-toggle",b);d.href="#",d.title="Layers",L.Browser.touch?L.DomEvent.on(d,"click",L.DomEvent.stopPropagation).on(d,"click",L.DomEvent.preventDefault).on(d,"click",this._expand,this):(L.DomEvent.on(b,"mouseover",this._expand,this).on(b,"mouseout",this._collapse,this),L.DomEvent.on(d,"focus",this._expand,this)),this._map.on("movestart",this._collapse,this)}else this._expand();this._baseLayersList=L.DomUtil.create("select",a+"-base",c),L.DomEvent.on(this._baseLayersList,"change",this._onBaseLayerOptionChange,this),this._separator=L.DomUtil.create("div",a+"-separator",c),this._overlaysList=L.DomUtil.create("select",a+"-overlays",c),this._overlaysList.setAttribute("multiple",!0),this._overlaysList.style.width="100%",L.DomEvent.on(this._overlaysList,"change",this._onOverlayLayerOptionChange,this),b.appendChild(c)},_onBaseLayerOptionChange:function(){var a=this._baseLayersList.selectedIndex,b=this._baseLayersList.options[a],c=this._layers[b.layerId];this._changeBaseLayer(c)},_changeBaseLayer:function(a){this._handlingClick=!0,this._map.addLayer(a.layer),this._map.removeLayer(this._activeBaseLayer.layer),this._map.setZoom(this._map.getZoom()),this._map.fire("baselayerchange",{layer:a.layer}),this._activeBaseLayer=a,this._handlingClick=!1},_onOverlayLayerOptionChange:function(){this._handlingClick=!0;for(var a=this._overlaysList.options,b=0;b<a.length;b++){var c=a[b],d=this._layers[c.layerId].layer;c.selected?this._map.hasLayer(d)||this._map.addLayer(d):this._map.hasLayer(d)&&this._map.removeLayer(d)}this._handlingClick=!1},_addItem:function(a){var b=this._createOptionElement(a);a.overlay?this._overlaysList.appendChild(b):this._baseLayersList.appendChild(b)},_createOptionElement:function(a){var b=document.createElement("option");return b.layerId=L.stamp(a.layer),b.innerHTML=a.name,this._map.hasLayer(a.layer)&&b.setAttribute("selected",!0),b},_collapse:function(a){a.target===this._container&&L.Control.Layers.prototype._collapse.apply(this,arguments)}}),L.control.selectLayers=function(a,b,c){return new L.Control.SelectLayers(a,b,c)};
L.Control.SelectLayers=L.Control.ActiveLayers.extend({_initLayout:function(){var a="leaflet-control-layers",b=this._container=L.DomUtil.create("div",a);L.DomEvent.disableClickPropagation(b),L.Browser.touch?L.DomEvent.on(b,"click",L.DomEvent.stopPropagation):L.DomEvent.on(b,"mousewheel",L.DomEvent.stopPropagation);var c=this._form=L.DomUtil.create("form",a+"-list");if(this.options.collapsed){var d=this._layersLink=L.DomUtil.create("a",a+"-toggle",b);d.href="#",d.title="Layers",L.Browser.touch?L.DomEvent.on(d,"click",L.DomEvent.stopPropagation).on(d,"click",L.DomEvent.preventDefault).on(d,"click",this._expand,this):(L.DomEvent.on(b,"mouseover",this._expand,this).on(b,"mouseout",this._collapse,this),L.DomEvent.on(d,"focus",this._expand,this)),this._map.on("movestart",this._collapse,this)}else this._expand();this._baseLayersList=L.DomUtil.create("select",a+"-base",c),L.DomEvent.on(this._baseLayersList,"change",this._onBaseLayerOptionChange,this),this._separator=L.DomUtil.create("div",a+"-separator",c),this._overlaysList=L.DomUtil.create("select",a+"-overlays",c),this._overlaysList.setAttribute("multiple",!0),this._overlaysList.style.width="100%",L.DomEvent.on(this._overlaysList,"change",this._onOverlayLayerOptionChange,this),b.appendChild(c)},_onBaseLayerOptionChange:function(){var a=this._baseLayersList.selectedIndex,b=this._baseLayersList.options[a],c=this._layers[b.layerId];this._changeBaseLayer(c)},_changeBaseLayer:function(a){this._handlingClick=!0,this._map.addLayer(a.layer),this._map.removeLayer(this._activeBaseLayer.layer),this._map.setZoom(this._map.getZoom()),this._map.fire("baselayerchange",{layer:a.layer}),this._activeBaseLayer=a,this._handlingClick=!1},_onOverlayLayerOptionChange:function(){this._handlingClick=!0;for(var a=this._overlaysList.options,b=0;b<a.length;b++){var c=a[b],d=this._layers[c.layerId].layer;c.selected?this._map.hasLayer(d)||this._map.addLayer(d):this._map.hasLayer(d)&&this._map.removeLayer(d)}this._handlingClick=!1},_addItem:function(a){var b=this._createOptionElement(a);a.overlay?this._overlaysList.appendChild(b):this._baseLayersList.appendChild(b)},_createOptionElement:function(a){var b=document.createElement("option");return b.layerId=L.stamp(a.layer),b.innerHTML=a.name,this._map.hasLayer(a.layer)&&b.setAttribute("selected",!0),b},_collapse:function(a){a.target===this._container&&L.Control.Layers.prototype._collapse.apply(this,arguments)}}),L.control.selectLayers=function(a,b,c){return new L.Control.SelectLayers(a,b,c)};