leaflet.markercluster.layersupport
Advanced tools
Comparing version 1.0.3 to 1.0.4
/** | ||
* Leaflet.MarkerCluster.LayerSupport 1.0.3+1372080 | ||
* Leaflet.MarkerCluster.LayerSupport 1.0.4+8ea1cba | ||
* Sub-plugin for Leaflet.markercluster plugin (MCG in short); brings compatibility with L.Control.Layers and other Leaflet plugins. | ||
* (c) 2015-2016 Boris Seang | ||
* (c) 2015-2017 Boris Seang | ||
* License MIT | ||
@@ -17,5 +17,2 @@ */ | ||
var LMCG = L.MarkerClusterGroup, | ||
LMCGproto = LMCG.prototype; | ||
/** | ||
@@ -27,3 +24,3 @@ * Extends the L.MarkerClusterGroup class by mainly overriding methods for | ||
*/ | ||
var MarkerClusterGroupLayerSupport = LMCG.extend({ | ||
L.MarkerClusterGroup.LayerSupport = L.MarkerClusterGroup.extend({ | ||
@@ -36,3 +33,3 @@ options: { | ||
initialize: function (options) { | ||
LMCGproto.initialize.call(this, options); | ||
L.MarkerClusterGroup.prototype.initialize.call(this, options); | ||
@@ -60,3 +57,3 @@ // Replace the MCG internal featureGroup's so that they directly | ||
* @param layers L.Layer|Array(L.Layer) layer(s) to be stamped. | ||
* @returns {MarkerClusterGroupLayerSupport} this. | ||
* @returns {L.MarkerClusterGroup.LayerSupport} this. | ||
*/ | ||
@@ -75,13 +72,13 @@ checkIn: function (layers) { | ||
* @param layers L.Layer|Array(L.Layer) layer(s) to be un-stamped. | ||
* @returns {MarkerClusterGroupLayerSupport} this. | ||
* @returns {L.MarkerClusterGroup.LayerSupport} this. | ||
*/ | ||
checkOut: function (layers) { | ||
var layersArray = this._toArray(layers), | ||
separated = this._separateSingleFromGroupLayers(layersArray, { | ||
groups: [], | ||
singles: [] | ||
}), | ||
groups = separated.groups, | ||
singles = separated.singles, | ||
i, layer; | ||
separated = this._separateSingleFromGroupLayers(layersArray, { | ||
groups: [], | ||
singles: [] | ||
}), | ||
groups = separated.groups, | ||
singles = separated.singles, | ||
i, layer; | ||
@@ -114,9 +111,9 @@ // Un-stamp single layers. | ||
* @param layers (L.Layer|L.Layer[]) single and/or group layers to be added. | ||
* @returns {MarkerClusterGroupLayerSupport} this. | ||
* @returns {L.MarkerClusterGroup.LayerSupport} this. | ||
*/ | ||
addLayers: function (layers) { | ||
var layersArray = this._toArray(layers), | ||
separated = this._checkInGetSeparated(layersArray), | ||
groups = separated.groups, | ||
i, group, id; | ||
separated = this._checkInGetSeparated(layersArray), | ||
groups = separated.groups, | ||
i, group, id; | ||
@@ -142,4 +139,4 @@ // Batch add all single layers. | ||
}, | ||
_originalAddLayer: LMCGproto.addLayer, | ||
_originalAddLayers: LMCGproto.addLayers, | ||
_originalAddLayer: L.MarkerClusterGroup.prototype.addLayer, | ||
_originalAddLayers: L.MarkerClusterGroup.prototype.addLayers, | ||
@@ -150,14 +147,14 @@ /** | ||
* @param layers (L.Layer|L.Layer[]) single and/or group layers to be removed. | ||
* @returns {MarkerClusterGroupLayerSupport} this. | ||
* @returns {L.MarkerClusterGroup.LayerSupport} this. | ||
*/ | ||
removeLayers: function (layers) { | ||
var layersArray = this._toArray(layers), | ||
separated = this._separateSingleFromGroupLayers(layersArray, { | ||
groups: [], | ||
singles: [] | ||
}), | ||
groups = separated.groups, | ||
singles = separated.singles, | ||
i = 0, | ||
group, id; | ||
separated = this._separateSingleFromGroupLayers(layersArray, { | ||
groups: [], | ||
singles: [] | ||
}), | ||
groups = separated.groups, | ||
singles = separated.singles, | ||
i = 0, | ||
group, id; | ||
@@ -186,4 +183,4 @@ // Batch remove single layers from MCG. | ||
}, | ||
_originalRemoveLayer: LMCGproto.removeLayer, | ||
_originalRemoveLayers: LMCGproto.removeLayers, | ||
_originalRemoveLayer: L.MarkerClusterGroup.prototype.removeLayer, | ||
_originalRemoveLayers: L.MarkerClusterGroup.prototype.removeLayers, | ||
@@ -203,6 +200,6 @@ onAdd: function (map) { | ||
var toBeReAdded = this._removePreAddedLayers(map), | ||
id, group, i; | ||
id, group, i; | ||
// Normal MCG onAdd. | ||
LMCGproto.onAdd.call(this, map); | ||
this._originalOnAdd.call(this, map); | ||
@@ -232,2 +229,3 @@ // If layer Groups are added/removed from this group while it is not | ||
}, | ||
_originalOnAdd: L.MarkerClusterGroup.prototype.onAdd, | ||
@@ -241,3 +239,3 @@ // Do not restore the original map methods when removing the group from it. | ||
var duration = this.options.singleAddRemoveBufferDuration, | ||
fn; | ||
fn; | ||
@@ -263,6 +261,6 @@ if (duration > 0) { | ||
var singleAddRemoveBuffer = this._singleAddRemoveBuffer, | ||
i = 0, | ||
layersBuffer = [], | ||
currentOperation, | ||
currentOperationType; | ||
i = 0, | ||
layersBuffer = [], | ||
currentOperation, | ||
currentOperationType; | ||
@@ -289,8 +287,8 @@ for (; i < singleAddRemoveBuffer.length; i++) { | ||
var separated = this._separateSingleFromGroupLayers(layersArray, { | ||
groups: [], | ||
singles: [] | ||
}), | ||
groups = separated.groups, | ||
singles = separated.singles, | ||
i, layer; | ||
groups: [], | ||
singles: [] | ||
}), | ||
groups = separated.groups, | ||
singles = separated.singles, | ||
i, layer; | ||
@@ -321,5 +319,5 @@ // Recruit Layer Groups. | ||
var groups = output.groups, | ||
singles = output.singles, | ||
isArray = L.Util.isArray, | ||
layer; | ||
singles = output.singles, | ||
isArray = L.Util.isArray, | ||
layer; | ||
@@ -421,4 +419,4 @@ for (var i = 0; i < inputLayers.length; i++) { | ||
var layers = this._layers, | ||
toBeReAdded = [], | ||
layer; | ||
toBeReAdded = [], | ||
layer; | ||
@@ -540,2 +538,12 @@ for (var id in layers) { | ||
return this; | ||
}, | ||
// Make sure it uses addLayers when added to map. | ||
onAdd: function () { | ||
this._proxyMcgLayerSupportGroup.addLayers(this.getLayers()); | ||
}, | ||
// Make sure it uses removeLayers when removed from map. | ||
onRemove: function () { | ||
this._proxyMcgLayerSupportGroup.removeLayers(this.getLayers()); | ||
} | ||
@@ -575,8 +583,9 @@ | ||
L.markerClusterGroup.layerSupport = function (options) { | ||
return new MarkerClusterGroupLayerSupport(options); | ||
return new L.MarkerClusterGroup.LayerSupport(options); | ||
}; | ||
})); | ||
//# sourceMappingURL=leaflet.markercluster.layersupport-src.map | ||
//# sourceMappingURL=leaflet.markercluster.layersupport-src.js.map |
/*! | ||
Leaflet.MarkerCluster.LayerSupport 1.0.3+1372080 | ||
(c) 2015-2016 Boris Seang | ||
Leaflet.MarkerCluster.LayerSupport 1.0.4+8ea1cba | ||
(c) 2015-2017 Boris Seang | ||
License MIT | ||
*/ | ||
!function(e,r){"function"==typeof define&&define.amd?define(["leaflet"],r):r("object"==typeof module&&module.exports?require("leaflet"):e.L)}(this,function(e,r){var i=e.MarkerClusterGroup,o=i.prototype,t=i.extend({options:{singleAddRemoveBufferDuration:100},initialize:function(e){o.initialize.call(this,e),this._featureGroup=new a,this._featureGroup.addEventParent(this),this._nonPointGroup=new a,this._nonPointGroup.addEventParent(this),this._layers={},this._proxyLayerGroups={},this._proxyLayerGroupsNeedRemoving={},this._singleAddRemoveBuffer=[]},checkIn:function(e){var r=this._toArray(e);return this._checkInGetSeparated(r),this},checkOut:function(r){var i,o,t=this._toArray(r),a=this._separateSingleFromGroupLayers(t,{groups:[],singles:[]}),s=a.groups,n=a.singles;for(i=0;i<n.length;i++)o=n[i],delete this._layers[e.stamp(o)],delete o._mcgLayerSupportGroup;for(this._originalRemoveLayers(n),i=0;i<s.length;i++)o=s[i],this._dismissProxyLayerGroup(o);return this},addLayers:function(r){var i,o,t,a=this._toArray(r),s=this._checkInGetSeparated(a),n=s.groups;for(this._originalAddLayers(s.singles),i=0;i<n.length;i++)o=n[i],t=e.stamp(o),this._proxyLayerGroups[t]=o,delete this._proxyLayerGroupsNeedRemoving[t],this._map&&this._map._originalAddLayer(o)},addLayer:function(e){return this._bufferSingleAddRemove(e,"addLayers"),this},_originalAddLayer:o.addLayer,_originalAddLayers:o.addLayers,removeLayers:function(r){var i,o,t=this._toArray(r),a=this._separateSingleFromGroupLayers(t,{groups:[],singles:[]}),s=a.groups,n=a.singles,p=0;for(this._originalRemoveLayers(n);p<s.length;p++)i=s[p],o=e.stamp(i),delete this._proxyLayerGroups[o],this._map?this._map._originalRemoveLayer(i):this._proxyLayerGroupsNeedRemoving[o]=i;return this},removeLayer:function(e){return this._bufferSingleAddRemove(e,"removeLayers"),this},_originalRemoveLayer:o.removeLayer,_originalRemoveLayers:o.removeLayers,onAdd:function(r){r._originalAddLayer=r._originalAddLayer||r.addLayer,r._originalRemoveLayer=r._originalRemoveLayer||r.removeLayer,e.extend(r,n);var i,t,a,s=this._removePreAddedLayers(r);o.onAdd.call(this,r);for(i in this._proxyLayerGroups)t=this._proxyLayerGroups[i],r._originalAddLayer(t);for(i in this._proxyLayerGroupsNeedRemoving)t=this._proxyLayerGroupsNeedRemoving[i],r._originalRemoveLayer(t),delete this._proxyLayerGroupsNeedRemoving[i];for(a=0;a<s.length;a++)r.addLayer(s[a])},_bufferSingleAddRemove:function(r,i){var o,t=this.options.singleAddRemoveBufferDuration;t>0?(this._singleAddRemoveBuffer.push({type:i,layer:r}),this._singleAddRemoveBufferTimeout||(o=e.bind(this._processSingleAddRemoveBuffer,this),this._singleAddRemoveBufferTimeout=setTimeout(o,t))):this[i](r)},_processSingleAddRemoveBuffer:function(){for(var e,r,i=this._singleAddRemoveBuffer,o=0,t=[];o<i.length;o++)e=i[o],r||(r=e.type),e.type===r?t.push(e.layer):(this[r](t),t=[e.layer]);this[r](t),i.length=0,clearTimeout(this._singleAddRemoveBufferTimeout),this._singleAddRemoveBufferTimeout=null},_checkInGetSeparated:function(r){var i,o,t=this._separateSingleFromGroupLayers(r,{groups:[],singles:[]}),a=t.groups,s=t.singles;for(i=0;i<a.length;i++)o=a[i],this._recruitLayerGroupAsProxy(o);for(i=0;i<s.length;i++)o=s[i],this._removeFromOtherGroupsOrMap(o),this._layers[e.stamp(o)]=o,o._mcgLayerSupportGroup=this;return t},_separateSingleFromGroupLayers:function(r,i){for(var o,t=i.groups,a=i.singles,s=e.Util.isArray,n=0;n<r.length;n++)o=r[n],o instanceof e.LayerGroup?(t.push(o),this._separateSingleFromGroupLayers(o.getLayers(),i)):s(o)?this._separateSingleFromGroupLayers(o,i):a.push(o);return i},_recruitLayerGroupAsProxy:function(r){var i=r._proxyMcgLayerSupportGroup;if(i){if(i===this)return;i.checkOut(r)}else this._removeFromOwnMap(r);r._proxyMcgLayerSupportGroup=this,r._originalAddLayer=r._originalAddLayer||r.addLayer,r._originalRemoveLayer=r._originalRemoveLayer||r.removeLayer,e.extend(r,s)},_dismissProxyLayerGroup:function(i){if(i._proxyMcgLayerSupportGroup!==r&&i._proxyMcgLayerSupportGroup===this){delete i._proxyMcgLayerSupportGroup,i.addLayer=i._originalAddLayer,i.removeLayer=i._originalRemoveLayer;var o=e.stamp(i);delete this._proxyLayerGroups[o],delete this._proxyLayerGroupsNeedRemoving[o],this._removeFromOwnMap(i)}},_removeFromOtherGroupsOrMap:function(e){var r=e._mcgLayerSupportGroup;if(r){if(r===this)return;r.checkOut(e)}else e.__parent?e.__parent._group.removeLayer(e):this._removeFromOwnMap(e)},_removeFromOwnMap:function(e){e._map&&e._map.removeLayer(e)},_removePreAddedLayers:function(e){var r,i=this._layers,o=[];for(var t in i)r=i[t],r._map&&(o.push(r),e._originalRemoveLayer(r));return o},_toArray:function(r){return e.Util.isArray(r)?r:[r]}}),a=e.FeatureGroup.extend({addLayer:function(r){if(this.hasLayer(r))return this;r.addEventParent(this);var i=e.stamp(r);return this._layers[i]=r,this._map&&this._map._originalAddLayer(r),this.fire("layeradd",{layer:r})},removeLayer:function(r){if(!this.hasLayer(r))return this;r in this._layers&&(r=this._layers[r]),r.removeEventParent(this);var i=e.stamp(r);return this._map&&this._layers[i]&&this._map._originalRemoveLayer(this._layers[i]),delete this._layers[i],this.fire("layerremove",{layer:r})},onAdd:function(e){this._map=e,this.eachLayer(e._originalAddLayer,e)},onRemove:function(e){this.eachLayer(e._originalRemoveLayer,e),this._map=null}}),s={addLayer:function(e){var r=this.getLayerId(e);return this._layers[r]=e,this._map?this._proxyMcgLayerSupportGroup.addLayer(e):this._proxyMcgLayerSupportGroup.checkIn(e),this},removeLayer:function(e){var r=e in this._layers?e:this.getLayerId(e);return this._proxyMcgLayerSupportGroup.removeLayer(e),delete this._layers[r],this}},n={addLayer:function(e){return e._mcgLayerSupportGroup?e._mcgLayerSupportGroup._originalAddLayer(e):this._originalAddLayer(e)},removeLayer:function(e){return e._mcgLayerSupportGroup?e._mcgLayerSupportGroup._originalRemoveLayer(e):this._originalRemoveLayer(e)}};e.markerClusterGroup.layerSupport=function(e){return new t(e)}}); | ||
!function(e,r){"function"==typeof define&&define.amd?define(["leaflet"],r):r("object"==typeof module&&module.exports?require("leaflet"):e.L)}(this,function(e,r){e.MarkerClusterGroup.LayerSupport=e.MarkerClusterGroup.extend({options:{singleAddRemoveBufferDuration:100},initialize:function(r){e.MarkerClusterGroup.prototype.initialize.call(this,r),this._featureGroup=new o,this._featureGroup.addEventParent(this),this._nonPointGroup=new o,this._nonPointGroup.addEventParent(this),this._layers={},this._proxyLayerGroups={},this._proxyLayerGroupsNeedRemoving={},this._singleAddRemoveBuffer=[]},checkIn:function(e){var r=this._toArray(e);return this._checkInGetSeparated(r),this},checkOut:function(r){var o,t,i=this._toArray(r),a=this._separateSingleFromGroupLayers(i,{groups:[],singles:[]}),s=a.groups,n=a.singles;for(o=0;o<n.length;o++)t=n[o],delete this._layers[e.stamp(t)],delete t._mcgLayerSupportGroup;for(this._originalRemoveLayers(n),o=0;o<s.length;o++)t=s[o],this._dismissProxyLayerGroup(t);return this},addLayers:function(r){var o,t,i,a=this._toArray(r),s=this._checkInGetSeparated(a),n=s.groups;for(this._originalAddLayers(s.singles),o=0;o<n.length;o++)t=n[o],i=e.stamp(t),this._proxyLayerGroups[i]=t,delete this._proxyLayerGroupsNeedRemoving[i],this._map&&this._map._originalAddLayer(t)},addLayer:function(e){return this._bufferSingleAddRemove(e,"addLayers"),this},_originalAddLayer:e.MarkerClusterGroup.prototype.addLayer,_originalAddLayers:e.MarkerClusterGroup.prototype.addLayers,removeLayers:function(r){var o,t,i=this._toArray(r),a=this._separateSingleFromGroupLayers(i,{groups:[],singles:[]}),s=a.groups,n=a.singles,p=0;for(this._originalRemoveLayers(n);p<s.length;p++)o=s[p],t=e.stamp(o),delete this._proxyLayerGroups[t],this._map?this._map._originalRemoveLayer(o):this._proxyLayerGroupsNeedRemoving[t]=o;return this},removeLayer:function(e){return this._bufferSingleAddRemove(e,"removeLayers"),this},_originalRemoveLayer:e.MarkerClusterGroup.prototype.removeLayer,_originalRemoveLayers:e.MarkerClusterGroup.prototype.removeLayers,onAdd:function(r){r._originalAddLayer=r._originalAddLayer||r.addLayer,r._originalRemoveLayer=r._originalRemoveLayer||r.removeLayer,e.extend(r,i);var o,t,a,s=this._removePreAddedLayers(r);this._originalOnAdd.call(this,r);for(o in this._proxyLayerGroups)t=this._proxyLayerGroups[o],r._originalAddLayer(t);for(o in this._proxyLayerGroupsNeedRemoving)t=this._proxyLayerGroupsNeedRemoving[o],r._originalRemoveLayer(t),delete this._proxyLayerGroupsNeedRemoving[o];for(a=0;a<s.length;a++)r.addLayer(s[a])},_originalOnAdd:e.MarkerClusterGroup.prototype.onAdd,_bufferSingleAddRemove:function(r,o){var t,i=this.options.singleAddRemoveBufferDuration;i>0?(this._singleAddRemoveBuffer.push({type:o,layer:r}),this._singleAddRemoveBufferTimeout||(t=e.bind(this._processSingleAddRemoveBuffer,this),this._singleAddRemoveBufferTimeout=setTimeout(t,i))):this[o](r)},_processSingleAddRemoveBuffer:function(){for(var e,r,o=this._singleAddRemoveBuffer,t=0,i=[];t<o.length;t++)e=o[t],r||(r=e.type),e.type===r?i.push(e.layer):(this[r](i),i=[e.layer]);this[r](i),o.length=0,clearTimeout(this._singleAddRemoveBufferTimeout),this._singleAddRemoveBufferTimeout=null},_checkInGetSeparated:function(r){var o,t,i=this._separateSingleFromGroupLayers(r,{groups:[],singles:[]}),a=i.groups,s=i.singles;for(o=0;o<a.length;o++)t=a[o],this._recruitLayerGroupAsProxy(t);for(o=0;o<s.length;o++)t=s[o],this._removeFromOtherGroupsOrMap(t),this._layers[e.stamp(t)]=t,t._mcgLayerSupportGroup=this;return i},_separateSingleFromGroupLayers:function(r,o){for(var t,i=o.groups,a=o.singles,s=e.Util.isArray,n=0;n<r.length;n++)t=r[n],t instanceof e.LayerGroup?(i.push(t),this._separateSingleFromGroupLayers(t.getLayers(),o)):s(t)?this._separateSingleFromGroupLayers(t,o):a.push(t);return o},_recruitLayerGroupAsProxy:function(r){var o=r._proxyMcgLayerSupportGroup;if(o){if(o===this)return;o.checkOut(r)}else this._removeFromOwnMap(r);r._proxyMcgLayerSupportGroup=this,r._originalAddLayer=r._originalAddLayer||r.addLayer,r._originalRemoveLayer=r._originalRemoveLayer||r.removeLayer,e.extend(r,t)},_dismissProxyLayerGroup:function(o){if(o._proxyMcgLayerSupportGroup!==r&&o._proxyMcgLayerSupportGroup===this){delete o._proxyMcgLayerSupportGroup,o.addLayer=o._originalAddLayer,o.removeLayer=o._originalRemoveLayer;var t=e.stamp(o);delete this._proxyLayerGroups[t],delete this._proxyLayerGroupsNeedRemoving[t],this._removeFromOwnMap(o)}},_removeFromOtherGroupsOrMap:function(e){var r=e._mcgLayerSupportGroup;if(r){if(r===this)return;r.checkOut(e)}else e.__parent?e.__parent._group.removeLayer(e):this._removeFromOwnMap(e)},_removeFromOwnMap:function(e){e._map&&e._map.removeLayer(e)},_removePreAddedLayers:function(e){var r,o=this._layers,t=[];for(var i in o)r=o[i],r._map&&(t.push(r),e._originalRemoveLayer(r));return t},_toArray:function(r){return e.Util.isArray(r)?r:[r]}});var o=e.FeatureGroup.extend({addLayer:function(r){if(this.hasLayer(r))return this;r.addEventParent(this);var o=e.stamp(r);return this._layers[o]=r,this._map&&this._map._originalAddLayer(r),this.fire("layeradd",{layer:r})},removeLayer:function(r){if(!this.hasLayer(r))return this;r in this._layers&&(r=this._layers[r]),r.removeEventParent(this);var o=e.stamp(r);return this._map&&this._layers[o]&&this._map._originalRemoveLayer(this._layers[o]),delete this._layers[o],this.fire("layerremove",{layer:r})},onAdd:function(e){this._map=e,this.eachLayer(e._originalAddLayer,e)},onRemove:function(e){this.eachLayer(e._originalRemoveLayer,e),this._map=null}}),t={addLayer:function(e){var r=this.getLayerId(e);return this._layers[r]=e,this._map?this._proxyMcgLayerSupportGroup.addLayer(e):this._proxyMcgLayerSupportGroup.checkIn(e),this},removeLayer:function(e){var r=e in this._layers?e:this.getLayerId(e);return this._proxyMcgLayerSupportGroup.removeLayer(e),delete this._layers[r],this},onAdd:function(){this._proxyMcgLayerSupportGroup.addLayers(this.getLayers())},onRemove:function(){this._proxyMcgLayerSupportGroup.removeLayers(this.getLayers())}},i={addLayer:function(e){return e._mcgLayerSupportGroup?e._mcgLayerSupportGroup._originalAddLayer(e):this._originalAddLayer(e)},removeLayer:function(e){return e._mcgLayerSupportGroup?e._mcgLayerSupportGroup._originalRemoveLayer(e):this._originalRemoveLayer(e)}};e.markerClusterGroup.layerSupport=function(r){return new e.MarkerClusterGroup.LayerSupport(r)}}); |
{ | ||
"name": "leaflet.markercluster.layersupport", | ||
"_name": "Leaflet.MarkerCluster.LayerSupport", | ||
"version": "1.0.3", | ||
"_year": "2015-2016", | ||
"version": "1.0.4", | ||
"_year": "2015-2017", | ||
"description": "Sub-plugin for Leaflet.markercluster plugin (MCG in short); brings compatibility with L.Control.Layers and other Leaflet plugins.", | ||
"main": "dist/leaflet.markercluster.layersupport", | ||
"files": ["dist/*.js"], | ||
"files": [ | ||
"dist/*.js" | ||
], | ||
"directories": { | ||
@@ -14,3 +16,5 @@ "example": "examples" | ||
"build": "jake build", | ||
"prepublish": "jake" | ||
"version": "npm run build && jake buildDocs && git add README.md", | ||
"postversion": "npm run build", | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -17,0 +21,0 @@ "repository": { |
@@ -0,1 +1,8 @@ | ||
<!-- ########################################################################## | ||
NOTE TO CONTRIBUTOR: | ||
this README is automatically generated from build/readme.template.md. | ||
Should you need to modify the README, please make your modifications on | ||
the template file. | ||
########################################################################### --> | ||
# Leaflet.MarkerCluster.LayerSupport | ||
@@ -27,3 +34,3 @@ Sub-plugin for [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster) | ||
## Requirements | ||
- Requires Leaflet 1.0.0+ | ||
- Requires Leaflet 1.x.x | ||
- [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster) plugin, version 1.0.0+ | ||
@@ -68,3 +75,3 @@ - For Leaflet 0.7.x use the [`v0.1.0` release](https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport/releases/tag/v0.1.0) or the [`leaflet-0.7` branch](https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport/tree/leaflet-0.7) | ||
#### Local copy | ||
1. Download the "<a href="https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport/releases/download/v1.0.3/leaflet.markercluster.layersupport.js">`leaflet.markercluster.layersupport.js`</a>" file from the [`v1.0.3` release](https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport/releases/tag/v1.0.3). | ||
1. Download the "<a href="https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport/releases/download/v1.0.4/leaflet.markercluster.layersupport.js">`leaflet.markercluster.layersupport.js`</a>" file from the [`v1.0.4` release](https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport/releases/tag/v1.0.4). | ||
2. Place the file alongside your page. | ||
@@ -74,10 +81,25 @@ 3. Add the `script` tag (see [Quick Guide > HTML](#quick-guide)) to your page after Leaflet and Leaflet.markercluster scripts. | ||
#### CDN | ||
You can alternatively use the free [unpkg](https://unpkg.com) CDN service, but keep in mind that it "[_is a free, best-effort service and cannot provide any uptime or support guarantees_](https://unpkg.com/#/about)". | ||
You can alternatively use the free [unpkg](https://unpkg.com) CDN service, but keep in mind that it | ||
"[_is a free, best-effort service and cannot provide any uptime or support guarantees_](https://unpkg.com/#/about)". | ||
```html | ||
<!-- After Leaflet and Leaflet.markercluster scripts --> | ||
<script src="https://unpkg.com/leaflet.markercluster.layersupport@1.0.3/dist/leaflet.markercluster.layersupport.js"></script> | ||
<script src="https://unpkg.com/leaflet.markercluster.layersupport@1.0.4/dist/leaflet.markercluster.layersupport.js"></script> | ||
``` | ||
#### npm | ||
1. Add this package to your project: | ||
```bash | ||
$ npm install leaflet.markercluster.layersupport --save | ||
``` | ||
2. If you are using a bundling tool, import in your JavaScript. | ||
It only performs the side effect of attaching to the global `L` namespace, | ||
so you do not need to store it into a local variable or import a namespace. | ||
```javascript | ||
require('leaflet.markercluster.layersupport'); | ||
// Or with ES6: | ||
import 'leaflet.markercluster.layersupport'; | ||
``` | ||
### Creation | ||
@@ -84,0 +106,0 @@ Simply use the `L.markerClusterGroup.layerSupport` factory instead of your regular `L.markerClusterGroup`: |
Sorry, the diff of this file is not supported yet
35702
6
473
206