New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

leaflet.markercluster.layersupport

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet.markercluster.layersupport - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

912

dist/leaflet.markercluster.layersupport-src.js
/**
* Leaflet.MarkerCluster.LayerSupport 1.0.2+7558cd3
* Leaflet.MarkerCluster.LayerSupport 1.0.3+1372080
* Sub-plugin for Leaflet.markercluster plugin (MCG in short); brings compatibility with L.Control.Layers and other Leaflet plugins.

@@ -17,591 +17,549 @@ * (c) 2015-2016 Boris Seang

var LMCG = L.MarkerClusterGroup,
LMCGproto = LMCG.prototype;
/**
* Leaflet.MarkerCluster.LayerSupport sub-plugin for Leaflet.markercluster plugin.
* Brings compatibility with direct map.addLayer/removeLayer and other plugins.
* Copyright (c) 2015 Boris Seang
* Distributed under the MIT License (Expat type)
* Extends the L.MarkerClusterGroup class by mainly overriding methods for
* addition/removal of layers, so that they can also be directly added/removed
* from the map later on while still clustering in this group.
* @type {L.MarkerClusterGroup}
*/
var MarkerClusterGroupLayerSupport = LMCG.extend({
// The following UMD is quite useless as Leaflet.markercluster does not currently
// support UMD in the first place. But when it will, we would simply need to add
// the 'leaflet.markercluster' dependency (need to keep 'leaflet' to access
// L.FeatureGroup, L.FeatureGroup.EVENTS, L.LayerGroup and L.markerClusterGroup).
// Also need to make sure the 'leaflet' is the same as the one called by MCG.
options: {
// Buffer single addLayer and removeLayer requests for efficiency.
singleAddRemoveBufferDuration: 100 // in ms.
},
// Universal Module Definition
// from https://github.com/umdjs/umd/blob/master/returnExportsGlobal.js
// as recommended by https://github.com/Leaflet/Leaflet/blob/master/PLUGIN-GUIDE.md#module-loaders
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['leaflet'], function (L) {
return (L.MarkerClusterGroup.LayerSupport = 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.LayerSupport = factory(root.L);
}
}(this, function (L, undefined) { // Does not actually expect the 'undefined' argument, it is just a trick to have an undefined variable.
initialize: function (options) {
LMCGproto.initialize.call(this, options);
var LMCG = L.MarkerClusterGroup,
LMCGproto = LMCG.prototype;
// Replace the MCG internal featureGroup's so that they directly
// access the map add/removal methods, bypassing the switch agent.
this._featureGroup = new _ByPassingFeatureGroup();
this._featureGroup.addEventParent(this);
/**
* Extends the L.MarkerClusterGroup class by mainly overriding methods for
* addition/removal of layers, so that they can also be directly added/removed
* from the map later on while still clustering in this group.
* @type {L.MarkerClusterGroup}
*/
var MarkerClusterGroupLayerSupport = LMCG.extend({
this._nonPointGroup = new _ByPassingFeatureGroup();
this._nonPointGroup.addEventParent(this);
statics: {
version: '1.0.1'
},
// Keep track of what should be "represented" on map (can be clustered).
this._layers = {};
this._proxyLayerGroups = {};
this._proxyLayerGroupsNeedRemoving = {};
options: {
// Buffer single addLayer and removeLayer requests for efficiency.
singleAddRemoveBufferDuration: 100 // in ms.
},
// Buffer single addLayer and removeLayer requests.
this._singleAddRemoveBuffer = [];
},
initialize: function (options) {
LMCGproto.initialize.call(this, options);
/**
* Stamps the passed layers as being part of this group, but without adding
* them to the map right now.
* @param layers L.Layer|Array(L.Layer) layer(s) to be stamped.
* @returns {MarkerClusterGroupLayerSupport} this.
*/
checkIn: function (layers) {
var layersArray = this._toArray(layers);
// Replace the MCG internal featureGroup's so that they directly
// access the map add/removal methods, bypassing the switch agent.
this._featureGroup = new _ByPassingFeatureGroup();
this._featureGroup.addEventParent(this);
this._checkInGetSeparated(layersArray);
this._nonPointGroup = new _ByPassingFeatureGroup();
this._nonPointGroup.addEventParent(this);
return this;
},
// Keep track of what should be "represented" on map (can be clustered).
this._layers = {};
this._proxyLayerGroups = {};
this._proxyLayerGroupsNeedRemoving = {};
/**
* Un-stamps the passed layers from being part of this group. It has to
* remove them from map (if they are) since they will no longer cluster.
* @param layers L.Layer|Array(L.Layer) layer(s) to be un-stamped.
* @returns {MarkerClusterGroupLayerSupport} this.
*/
checkOut: function (layers) {
var layersArray = this._toArray(layers),
separated = this._separateSingleFromGroupLayers(layersArray, {
groups: [],
singles: []
}),
groups = separated.groups,
singles = separated.singles,
i, layer;
// Buffer single addLayer and removeLayer requests.
this._singleAddRemoveBuffer = [];
},
// Un-stamp single layers.
for (i = 0; i < singles.length; i++) {
layer = singles[i];
delete this._layers[L.stamp(layer)];
delete layer._mcgLayerSupportGroup;
}
/**
* Stamps the passed layers as being part of this group, but without adding
* them to the map right now.
* @param layers L.Layer|Array(L.Layer) layer(s) to be stamped.
* @returns {MarkerClusterGroupLayerSupport} this.
*/
checkIn: function (layers) {
var layersArray = this._toArray(layers);
// Batch remove single layers from MCG.
// Note: as for standard MCG, if single layers have been added to
// another MCG in the meantime, their __parent will have changed,
// so weird things would happen.
this._originalRemoveLayers(singles);
this._checkInGetSeparated(layersArray);
// Dismiss Layer Groups.
for (i = 0; i < groups.length; i++) {
layer = groups[i];
this._dismissProxyLayerGroup(layer);
}
return this;
},
return this;
},
/**
* Un-stamps the passed layers from being part of this group. It has to
* remove them from map (if they are) since they will no longer cluster.
* @param layers L.Layer|Array(L.Layer) layer(s) to be un-stamped.
* @returns {MarkerClusterGroupLayerSupport} this.
*/
checkOut: function (layers) {
var layersArray = this._toArray(layers),
separated = this._separateSingleFromGroupLayers(layersArray, {
groups: [],
singles: []
}),
groups = separated.groups,
singles = separated.singles,
i, layer;
/**
* Checks in and adds an array of layers to this group.
* Layer Groups are also added to the map to fire their event.
* @param layers (L.Layer|L.Layer[]) single and/or group layers to be added.
* @returns {MarkerClusterGroupLayerSupport} this.
*/
addLayers: function (layers) {
var layersArray = this._toArray(layers),
separated = this._checkInGetSeparated(layersArray),
groups = separated.groups,
i, group, id;
// Un-stamp single layers.
for (i = 0; i < singles.length; i++) {
layer = singles[i];
delete this._layers[L.stamp(layer)];
delete layer._mcgLayerSupportGroup;
}
// Batch add all single layers.
this._originalAddLayers(separated.singles);
// Batch remove single layers from MCG.
// Note: as for standard MCG, if single layers have been added to
// another MCG in the meantime, their __parent will have changed,
// so weird things would happen.
this._originalRemoveLayers(singles);
// Dismiss Layer Groups.
for (i = 0; i < groups.length; i++) {
layer = groups[i];
this._dismissProxyLayerGroup(layer);
// Add Layer Groups to the map so that they are registered there and
// the map fires 'layeradd' events for them as well.
for (i = 0; i < groups.length; i++) {
group = groups[i];
id = L.stamp(group);
this._proxyLayerGroups[id] = group;
delete this._proxyLayerGroupsNeedRemoving[id];
if (this._map) {
this._map._originalAddLayer(group);
}
}
},
addLayer: function (layer) {
this._bufferSingleAddRemove(layer, "addLayers");
return this;
},
_originalAddLayer: LMCGproto.addLayer,
_originalAddLayers: LMCGproto.addLayers,
return this;
},
/**
* Removes layers from this group but without check out.
* Layer Groups are also removed from the map to fire their event.
* @param layers (L.Layer|L.Layer[]) single and/or group layers to be removed.
* @returns {MarkerClusterGroupLayerSupport} 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;
/**
* Checks in and adds an array of layers to this group.
* Layer Groups are also added to the map to fire their event.
* @param layers (L.Layer|L.Layer[]) single and/or group layers to be added.
* @returns {MarkerClusterGroupLayerSupport} this.
*/
addLayers: function (layers) {
var layersArray = this._toArray(layers),
separated = this._checkInGetSeparated(layersArray),
groups = separated.groups,
i, group, id;
// Batch remove single layers from MCG.
this._originalRemoveLayers(singles);
// Batch add all single layers.
this._originalAddLayers(separated.singles);
// Add Layer Groups to the map so that they are registered there and
// the map fires 'layeradd' events for them as well.
for (i = 0; i < groups.length; i++) {
group = groups[i];
id = L.stamp(group);
this._proxyLayerGroups[id] = group;
delete this._proxyLayerGroupsNeedRemoving[id];
if (this._map) {
this._map._originalAddLayer(group);
}
// Remove Layer Groups from the map so that they are un-registered
// there and the map fires 'layerremove' events for them as well.
for (; i < groups.length; i++) {
group = groups[i];
id = L.stamp(group);
delete this._proxyLayerGroups[id];
if (this._map) {
this._map._originalRemoveLayer(group);
} else {
this._proxyLayerGroupsNeedRemoving[id] = group;
}
},
addLayer: function (layer) {
this._bufferSingleAddRemove(layer, "addLayers");
return this;
},
_originalAddLayer: LMCGproto.addLayer,
_originalAddLayers: LMCGproto.addLayers,
}
/**
* Removes layers from this group but without check out.
* Layer Groups are also removed from the map to fire their event.
* @param layers (L.Layer|L.Layer[]) single and/or group layers to be removed.
* @returns {MarkerClusterGroupLayerSupport} 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;
return this;
},
removeLayer: function (layer) {
this._bufferSingleAddRemove(layer, "removeLayers");
return this;
},
_originalRemoveLayer: LMCGproto.removeLayer,
_originalRemoveLayers: LMCGproto.removeLayers,
// Batch remove single layers from MCG.
this._originalRemoveLayers(singles);
onAdd: function (map) {
// Replace the map addLayer and removeLayer methods to place the
// switch agent that redirects layers when required.
map._originalAddLayer = map._originalAddLayer || map.addLayer;
map._originalRemoveLayer = map._originalRemoveLayer || map.removeLayer;
L.extend(map, _layerSwitchMap);
// Remove Layer Groups from the map so that they are un-registered
// there and the map fires 'layerremove' events for them as well.
for (; i < groups.length; i++) {
group = groups[i];
id = L.stamp(group);
delete this._proxyLayerGroups[id];
if (this._map) {
this._map._originalRemoveLayer(group);
} else {
this._proxyLayerGroupsNeedRemoving[id] = group;
}
}
// As this plugin allows the Application to add layers on map, some
// checked in layers might have been added already, whereas LayerSupport
// did not have a chance to inject the switch agent in to the map
// (if it was never added to map before). Therefore we need to
// remove all checked in layers from map!
var toBeReAdded = this._removePreAddedLayers(map),
id, group, i;
return this;
},
removeLayer: function (layer) {
this._bufferSingleAddRemove(layer, "removeLayers");
return this;
},
_originalRemoveLayer: LMCGproto.removeLayer,
_originalRemoveLayers: LMCGproto.removeLayers,
// Normal MCG onAdd.
LMCGproto.onAdd.call(this, map);
onAdd: function (map) {
// Replace the map addLayer and removeLayer methods to place the
// switch agent that redirects layers when required.
map._originalAddLayer = map._originalAddLayer || map.addLayer;
map._originalRemoveLayer = map._originalRemoveLayer || map.removeLayer;
L.extend(map, _layerSwitchMap);
// If layer Groups are added/removed from this group while it is not
// on map, Control.Layers gets out of sync until this is added back.
// As this plugin allows the Application to add layers on map, some
// checked in layers might have been added already, whereas LayerSupport
// did not have a chance to inject the switch agent in to the map
// (if it was never added to map before). Therefore we need to
// remove all checked in layers from map!
var toBeReAdded = this._removePreAddedLayers(map),
id, group, i;
// Restore proxy Layer Groups that may have been added to this
// group while it was off map.
for (id in this._proxyLayerGroups) {
group = this._proxyLayerGroups[id];
map._originalAddLayer(group);
}
// Normal MCG onAdd.
LMCGproto.onAdd.call(this, map);
// Remove proxy Layer Groups that may have been removed from this
// group while it was off map.
for (id in this._proxyLayerGroupsNeedRemoving) {
group = this._proxyLayerGroupsNeedRemoving[id];
map._originalRemoveLayer(group);
delete this._proxyLayerGroupsNeedRemoving[id];
}
// If layer Groups are added/removed from this group while it is not
// on map, Control.Layers gets out of sync until this is added back.
// Restore Layers.
for (i = 0; i < toBeReAdded.length; i++) {
map.addLayer(toBeReAdded[i]);
}
},
// Restore proxy Layer Groups that may have been added to this
// group while it was off map.
for (id in this._proxyLayerGroups) {
group = this._proxyLayerGroups[id];
map._originalAddLayer(group);
}
// Do not restore the original map methods when removing the group from it.
// Leaving them as-is does not harm, whereas restoring the original ones
// may kill the functionality of potential other LayerSupport groups on
// the same map. Therefore we do not need to override onRemove.
// Remove proxy Layer Groups that may have been removed from this
// group while it was off map.
for (id in this._proxyLayerGroupsNeedRemoving) {
group = this._proxyLayerGroupsNeedRemoving[id];
map._originalRemoveLayer(group);
delete this._proxyLayerGroupsNeedRemoving[id];
}
_bufferSingleAddRemove: function (layer, operationType) {
var duration = this.options.singleAddRemoveBufferDuration,
fn;
// Restore Layers.
for (i = 0; i < toBeReAdded.length; i++) {
map.addLayer(toBeReAdded[i]);
}
},
if (duration > 0) {
this._singleAddRemoveBuffer.push({
type: operationType,
layer: layer
});
// Do not restore the original map methods when removing the group from it.
// Leaving them as-is does not harm, whereas restoring the original ones
// may kill the functionality of potential other LayerSupport groups on
// the same map. Therefore we do not need to override onRemove.
if (!this._singleAddRemoveBufferTimeout) {
fn = L.bind(this._processSingleAddRemoveBuffer, this);
_bufferSingleAddRemove: function (layer, operationType) {
var duration = this.options.singleAddRemoveBufferDuration,
fn;
if (duration > 0) {
this._singleAddRemoveBuffer.push({
type: operationType,
layer: layer
});
if (!this._singleAddRemoveBufferTimeout) {
fn = L.bind(this._processSingleAddRemoveBuffer, this);
this._singleAddRemoveBufferTimeout = setTimeout(fn, duration);
}
} else { // If duration <= 0, process synchronously.
this[operationType](layer);
this._singleAddRemoveBufferTimeout = setTimeout(fn, duration);
}
},
_processSingleAddRemoveBuffer: function () {
// For now, simply cut the processes at each operation change
// (addLayers, removeLayers).
var singleAddRemoveBuffer = this._singleAddRemoveBuffer,
i = 0,
layersBuffer = [],
currentOperation,
currentOperationType;
} else { // If duration <= 0, process synchronously.
this[operationType](layer);
}
},
_processSingleAddRemoveBuffer: function () {
// For now, simply cut the processes at each operation change
// (addLayers, removeLayers).
var singleAddRemoveBuffer = this._singleAddRemoveBuffer,
i = 0,
layersBuffer = [],
currentOperation,
currentOperationType;
for (; i < singleAddRemoveBuffer.length; i++) {
currentOperation = singleAddRemoveBuffer[i];
if (!currentOperationType) {
currentOperationType = currentOperation.type;
}
if (currentOperation.type === currentOperationType) {
layersBuffer.push(currentOperation.layer);
} else {
this[currentOperationType](layersBuffer);
layersBuffer = [currentOperation.layer];
}
for (; i < singleAddRemoveBuffer.length; i++) {
currentOperation = singleAddRemoveBuffer[i];
if (!currentOperationType) {
currentOperationType = currentOperation.type;
}
this[currentOperationType](layersBuffer);
singleAddRemoveBuffer.length = 0;
clearTimeout(this._singleAddRemoveBufferTimeout);
this._singleAddRemoveBufferTimeout = null;
},
if (currentOperation.type === currentOperationType) {
layersBuffer.push(currentOperation.layer);
} else {
this[currentOperationType](layersBuffer);
layersBuffer = [currentOperation.layer];
}
}
this[currentOperationType](layersBuffer);
singleAddRemoveBuffer.length = 0;
clearTimeout(this._singleAddRemoveBufferTimeout);
this._singleAddRemoveBufferTimeout = null;
},
_checkInGetSeparated: function (layersArray) {
var separated = this._separateSingleFromGroupLayers(layersArray, {
groups: [],
singles: []
}),
groups = separated.groups,
singles = separated.singles,
i, layer;
_checkInGetSeparated: function (layersArray) {
var separated = this._separateSingleFromGroupLayers(layersArray, {
groups: [],
singles: []
}),
groups = separated.groups,
singles = separated.singles,
i, layer;
// Recruit Layer Groups.
// If they do not already belong to this group, they will be
// removed from map (together will all child layers).
for (i = 0; i < groups.length; i++) {
layer = groups[i];
this._recruitLayerGroupAsProxy(layer);
}
// Recruit Layer Groups.
// If they do not already belong to this group, they will be
// removed from map (together will all child layers).
for (i = 0; i < groups.length; i++) {
layer = groups[i];
this._recruitLayerGroupAsProxy(layer);
}
// Stamp single layers.
for (i = 0; i < singles.length; i++) {
layer = singles[i];
// Stamp single layers.
for (i = 0; i < singles.length; i++) {
layer = singles[i];
// Remove from previous group first.
this._removeFromOtherGroupsOrMap(layer);
// Remove from previous group first.
this._removeFromOtherGroupsOrMap(layer);
this._layers[L.stamp(layer)] = layer;
layer._mcgLayerSupportGroup = this;
}
this._layers[L.stamp(layer)] = layer;
layer._mcgLayerSupportGroup = this;
}
return separated;
},
return separated;
},
_separateSingleFromGroupLayers: function (inputLayers, output) {
var groups = output.groups,
singles = output.singles,
isArray = L.Util.isArray,
layer;
_separateSingleFromGroupLayers: function (inputLayers, output) {
var groups = output.groups,
singles = output.singles,
isArray = L.Util.isArray,
layer;
for (var i = 0; i < inputLayers.length; i++) {
layer = inputLayers[i];
for (var i = 0; i < inputLayers.length; i++) {
layer = inputLayers[i];
if (layer instanceof L.LayerGroup) {
groups.push(layer);
this._separateSingleFromGroupLayers(layer.getLayers(), output);
continue;
} else if (isArray(layer)) {
this._separateSingleFromGroupLayers(layer, output);
continue;
}
singles.push(layer);
if (layer instanceof L.LayerGroup) {
groups.push(layer);
this._separateSingleFromGroupLayers(layer.getLayers(), output);
continue;
} else if (isArray(layer)) {
this._separateSingleFromGroupLayers(layer, output);
continue;
}
return output;
},
singles.push(layer);
}
// Recruit the LayerGroup as a proxy, so that any layer that is added
// to / removed from that group later on is also added to / removed from
// this group.
// Check in and addition of already contained markers must be taken care
// of externally.
_recruitLayerGroupAsProxy: function (layerGroup) {
var otherMcgLayerSupportGroup = layerGroup._proxyMcgLayerSupportGroup;
return output;
},
// If it is not yet in this group, remove it from previous group
// or from map.
if (otherMcgLayerSupportGroup) {
if (otherMcgLayerSupportGroup === this) {
return;
}
// Remove from previous Layer Support group first.
// It will also be removed from map with child layers.
otherMcgLayerSupportGroup.checkOut(layerGroup);
} else {
this._removeFromOwnMap(layerGroup);
}
// Recruit the LayerGroup as a proxy, so that any layer that is added
// to / removed from that group later on is also added to / removed from
// this group.
// Check in and addition of already contained markers must be taken care
// of externally.
_recruitLayerGroupAsProxy: function (layerGroup) {
var otherMcgLayerSupportGroup = layerGroup._proxyMcgLayerSupportGroup;
layerGroup._proxyMcgLayerSupportGroup = this;
layerGroup._originalAddLayer =
layerGroup._originalAddLayer || layerGroup.addLayer;
layerGroup._originalRemoveLayer =
layerGroup._originalRemoveLayer || layerGroup.removeLayer;
L.extend(layerGroup, _proxyLayerGroup);
},
// Restore the normal LayerGroup behaviour.
// Removal and check out of contained markers must be taken care of externally.
_dismissProxyLayerGroup: function (layerGroup) {
if (layerGroup._proxyMcgLayerSupportGroup === undefined ||
layerGroup._proxyMcgLayerSupportGroup !== this) {
// If it is not yet in this group, remove it from previous group
// or from map.
if (otherMcgLayerSupportGroup) {
if (otherMcgLayerSupportGroup === this) {
return;
}
// Remove from previous Layer Support group first.
// It will also be removed from map with child layers.
otherMcgLayerSupportGroup.checkOut(layerGroup);
} else {
this._removeFromOwnMap(layerGroup);
}
delete layerGroup._proxyMcgLayerSupportGroup;
layerGroup.addLayer = layerGroup._originalAddLayer;
layerGroup.removeLayer = layerGroup._originalRemoveLayer;
layerGroup._proxyMcgLayerSupportGroup = this;
layerGroup._originalAddLayer =
layerGroup._originalAddLayer || layerGroup.addLayer;
layerGroup._originalRemoveLayer =
layerGroup._originalRemoveLayer || layerGroup.removeLayer;
L.extend(layerGroup, _proxyLayerGroup);
},
var id = L.stamp(layerGroup);
delete this._proxyLayerGroups[id];
delete this._proxyLayerGroupsNeedRemoving[id];
// Restore the normal LayerGroup behaviour.
// Removal and check out of contained markers must be taken care of externally.
_dismissProxyLayerGroup: function (layerGroup) {
if (layerGroup._proxyMcgLayerSupportGroup === undefined ||
layerGroup._proxyMcgLayerSupportGroup !== this) {
this._removeFromOwnMap(layerGroup);
},
return;
}
_removeFromOtherGroupsOrMap: function (layer) {
var otherMcgLayerSupportGroup = layer._mcgLayerSupportGroup;
delete layerGroup._proxyMcgLayerSupportGroup;
layerGroup.addLayer = layerGroup._originalAddLayer;
layerGroup.removeLayer = layerGroup._originalRemoveLayer;
if (otherMcgLayerSupportGroup) { // It is a Layer Support group.
if (otherMcgLayerSupportGroup === this) {
return;
}
otherMcgLayerSupportGroup.checkOut(layer);
var id = L.stamp(layerGroup);
delete this._proxyLayerGroups[id];
delete this._proxyLayerGroupsNeedRemoving[id];
} else if (layer.__parent) { // It is in a normal MCG.
layer.__parent._group.removeLayer(layer);
this._removeFromOwnMap(layerGroup);
},
} else { // It could still be on a map.
this._removeFromOwnMap(layer);
}
},
_removeFromOtherGroupsOrMap: function (layer) {
var otherMcgLayerSupportGroup = layer._mcgLayerSupportGroup;
// Remove layers that are being checked in, because they can now cluster.
_removeFromOwnMap: function (layer) {
if (layer._map) {
// This correctly fires layerremove event for Layer Groups as well.
layer._map.removeLayer(layer);
if (otherMcgLayerSupportGroup) { // It is a Layer Support group.
if (otherMcgLayerSupportGroup === this) {
return;
}
},
otherMcgLayerSupportGroup.checkOut(layer);
// In case checked in layers have been added to map whereas map is not redirected.
_removePreAddedLayers: function (map) {
var layers = this._layers,
toBeReAdded = [],
layer;
} else if (layer.__parent) { // It is in a normal MCG.
layer.__parent._group.removeLayer(layer);
for (var id in layers) {
layer = layers[id];
if (layer._map) {
toBeReAdded.push(layer);
map._originalRemoveLayer(layer);
}
}
} else { // It could still be on a map.
this._removeFromOwnMap(layer);
}
},
return toBeReAdded;
},
_toArray: function (item) {
return L.Util.isArray(item) ? item : [item];
// Remove layers that are being checked in, because they can now cluster.
_removeFromOwnMap: function (layer) {
if (layer._map) {
// This correctly fires layerremove event for Layer Groups as well.
layer._map.removeLayer(layer);
}
},
});
// In case checked in layers have been added to map whereas map is not redirected.
_removePreAddedLayers: function (map) {
var layers = this._layers,
toBeReAdded = [],
layer;
/**
* Extends the FeatureGroup by overriding add/removal methods that directly
* access the map original methods, bypassing the switch agent.
* Used internally in Layer Support for _featureGroup and _nonPointGroup only.
* @type {L.FeatureGroup}
* @private
*/
var _ByPassingFeatureGroup = L.FeatureGroup.extend({
// Re-implement just to change the map method.
addLayer: function (layer) {
if (this.hasLayer(layer)) {
return this;
for (var id in layers) {
layer = layers[id];
if (layer._map) {
toBeReAdded.push(layer);
map._originalRemoveLayer(layer);
}
}
layer.addEventParent(this);
return toBeReAdded;
},
var id = L.stamp(layer);
_toArray: function (item) {
return L.Util.isArray(item) ? item : [item];
}
this._layers[id] = layer;
});
if (this._map) {
// Use the original map addLayer.
this._map._originalAddLayer(layer);
}
/**
* Extends the FeatureGroup by overriding add/removal methods that directly
* access the map original methods, bypassing the switch agent.
* Used internally in Layer Support for _featureGroup and _nonPointGroup only.
* @type {L.FeatureGroup}
* @private
*/
var _ByPassingFeatureGroup = L.FeatureGroup.extend({
return this.fire('layeradd', {layer: layer});
},
// Re-implement just to change the map method.
addLayer: function (layer) {
if (this.hasLayer(layer)) {
return this;
}
// Re-implement just to change the map method.
removeLayer: function (layer) {
if (!this.hasLayer(layer)) {
return this;
}
if (layer in this._layers) {
layer = this._layers[layer];
}
layer.addEventParent(this);
layer.removeEventParent(this);
var id = L.stamp(layer);
var id = L.stamp(layer);
this._layers[id] = layer;
if (this._map && this._layers[id]) {
// Use the original map removeLayer.
this._map._originalRemoveLayer(this._layers[id]);
}
if (this._map) {
// Use the original map addLayer.
this._map._originalAddLayer(layer);
}
delete this._layers[id];
return this.fire('layeradd', {layer: layer});
},
return this.fire('layerremove', {layer: layer});
},
// Re-implement just to change the map method.
removeLayer: function (layer) {
if (!this.hasLayer(layer)) {
return this;
}
if (layer in this._layers) {
layer = this._layers[layer];
}
onAdd: function (map) {
this._map = map;
// Use the original map addLayer.
this.eachLayer(map._originalAddLayer, map);
},
layer.removeEventParent(this);
onRemove: function (map) {
var id = L.stamp(layer);
if (this._map && this._layers[id]) {
// Use the original map removeLayer.
this.eachLayer(map._originalRemoveLayer, map);
this._map = null;
this._map._originalRemoveLayer(this._layers[id]);
}
});
delete this._layers[id];
/**
* Toolbox to equip LayerGroups recruited as proxy.
* @type {{addLayer: Function, removeLayer: Function}}
* @private
*/
var _proxyLayerGroup = {
return this.fire('layerremove', {layer: layer});
},
// Re-implement to redirect addLayer to Layer Support group instead of map.
addLayer: function (layer) {
var id = this.getLayerId(layer);
onAdd: function (map) {
this._map = map;
// Use the original map addLayer.
this.eachLayer(map._originalAddLayer, map);
},
this._layers[id] = layer;
onRemove: function (map) {
// Use the original map removeLayer.
this.eachLayer(map._originalRemoveLayer, map);
this._map = null;
}
if (this._map) {
this._proxyMcgLayerSupportGroup.addLayer(layer);
} else {
this._proxyMcgLayerSupportGroup.checkIn(layer);
}
});
return this;
},
/**
* Toolbox to equip LayerGroups recruited as proxy.
* @type {{addLayer: Function, removeLayer: Function}}
* @private
*/
var _proxyLayerGroup = {
// Re-implement to redirect removeLayer to Layer Support group instead of map.
removeLayer: function (layer) {
// Re-implement to redirect addLayer to Layer Support group instead of map.
addLayer: function (layer) {
var id = this.getLayerId(layer);
var id = layer in this._layers ? layer : this.getLayerId(layer);
this._layers[id] = layer;
this._proxyMcgLayerSupportGroup.removeLayer(layer);
if (this._map) {
this._proxyMcgLayerSupportGroup.addLayer(layer);
} else {
this._proxyMcgLayerSupportGroup.checkIn(layer);
}
delete this._layers[id];
return this;
},
return this;
}
// Re-implement to redirect removeLayer to Layer Support group instead of map.
removeLayer: function (layer) {
};
var id = layer in this._layers ? layer : this.getLayerId(layer);
/**
* Toolbox to equip the Map with a switch agent that redirects layers
* addition/removal to their Layer Support group when defined.
* @type {{addLayer: Function, removeLayer: Function}}
* @private
*/
var _layerSwitchMap = {
this._proxyMcgLayerSupportGroup.removeLayer(layer);
addLayer: function (layer) {
if (layer._mcgLayerSupportGroup) {
// Use the original MCG addLayer.
return layer._mcgLayerSupportGroup._originalAddLayer(layer);
}
delete this._layers[id];
return this._originalAddLayer(layer);
},
return this;
}
removeLayer: function (layer) {
if (layer._mcgLayerSupportGroup) {
// Use the original MCG removeLayer.
return layer._mcgLayerSupportGroup._originalRemoveLayer(layer);
}
};
return this._originalRemoveLayer(layer);
/**
* Toolbox to equip the Map with a switch agent that redirects layers
* addition/removal to their Layer Support group when defined.
* @type {{addLayer: Function, removeLayer: Function}}
* @private
*/
var _layerSwitchMap = {
addLayer: function (layer) {
if (layer._mcgLayerSupportGroup) {
// Use the original MCG addLayer.
return layer._mcgLayerSupportGroup._originalAddLayer(layer);
}
};
return this._originalAddLayer(layer);
},
// Supply with a factory for consistency with Leaflet.
L.markerClusterGroup.layerSupport = function (options) {
return new MarkerClusterGroupLayerSupport(options);
};
removeLayer: function (layer) {
if (layer._mcgLayerSupportGroup) {
// Use the original MCG removeLayer.
return layer._mcgLayerSupportGroup._originalRemoveLayer(layer);
}
// Just return a value to define the module export.
return MarkerClusterGroupLayerSupport;
}));
return this._originalRemoveLayer(layer);
}
};
// Supply with a factory for consistency with Leaflet.
L.markerClusterGroup.layerSupport = function (options) {
return new MarkerClusterGroupLayerSupport(options);
};
}));
//# sourceMappingURL=leaflet.markercluster.layersupport-src.map
/*!
Leaflet.MarkerCluster.LayerSupport 1.0.2+7558cd3
Leaflet.MarkerCluster.LayerSupport 1.0.3+1372080
(c) 2015-2016 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){!function(e,r){"function"==typeof define&&define.amd?define(["leaflet"],function(e){return e.MarkerClusterGroup.LayerSupport=r(e)}):"object"==typeof module&&module.exports?module.exports=r(require("leaflet")):e.L.MarkerClusterGroup.LayerSupport=r(e.L)}(this,function(e,r){var t=e.MarkerClusterGroup,i=t.prototype,o=t.extend({statics:{version:"1.0.1"},options:{singleAddRemoveBufferDuration:100},initialize:function(e){i.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 t,i,o=this._toArray(r),a=this._separateSingleFromGroupLayers(o,{groups:[],singles:[]}),s=a.groups,n=a.singles;for(t=0;t<n.length;t++)i=n[t],delete this._layers[e.stamp(i)],delete i._mcgLayerSupportGroup;for(this._originalRemoveLayers(n),t=0;t<s.length;t++)i=s[t],this._dismissProxyLayerGroup(i);return this},addLayers:function(r){var t,i,o,a=this._toArray(r),s=this._checkInGetSeparated(a),n=s.groups;for(this._originalAddLayers(s.singles),t=0;t<n.length;t++)i=n[t],o=e.stamp(i),this._proxyLayerGroups[o]=i,delete this._proxyLayerGroupsNeedRemoving[o],this._map&&this._map._originalAddLayer(i)},addLayer:function(e){return this._bufferSingleAddRemove(e,"addLayers"),this},_originalAddLayer:i.addLayer,_originalAddLayers:i.addLayers,removeLayers:function(r){var t,i,o=this._toArray(r),a=this._separateSingleFromGroupLayers(o,{groups:[],singles:[]}),s=a.groups,n=a.singles,u=0;for(this._originalRemoveLayers(n);u<s.length;u++)t=s[u],i=e.stamp(t),delete this._proxyLayerGroups[i],this._map?this._map._originalRemoveLayer(t):this._proxyLayerGroupsNeedRemoving[i]=t;return this},removeLayer:function(e){return this._bufferSingleAddRemove(e,"removeLayers"),this},_originalRemoveLayer:i.removeLayer,_originalRemoveLayers:i.removeLayers,onAdd:function(r){r._originalAddLayer=r._originalAddLayer||r.addLayer,r._originalRemoveLayer=r._originalRemoveLayer||r.removeLayer,e.extend(r,n);var t,o,a,s=this._removePreAddedLayers(r);i.onAdd.call(this,r);for(t in this._proxyLayerGroups)o=this._proxyLayerGroups[t],r._originalAddLayer(o);for(t in this._proxyLayerGroupsNeedRemoving)o=this._proxyLayerGroupsNeedRemoving[t],r._originalRemoveLayer(o),delete this._proxyLayerGroupsNeedRemoving[t];for(a=0;a<s.length;a++)r.addLayer(s[a])},_bufferSingleAddRemove:function(r,t){var i,o=this.options.singleAddRemoveBufferDuration;o>0?(this._singleAddRemoveBuffer.push({type:t,layer:r}),this._singleAddRemoveBufferTimeout||(i=e.bind(this._processSingleAddRemoveBuffer,this),this._singleAddRemoveBufferTimeout=setTimeout(i,o))):this[t](r)},_processSingleAddRemoveBuffer:function(){for(var e,r,t=this._singleAddRemoveBuffer,i=0,o=[];i<t.length;i++)e=t[i],r||(r=e.type),e.type===r?o.push(e.layer):(this[r](o),o=[e.layer]);this[r](o),t.length=0,clearTimeout(this._singleAddRemoveBufferTimeout),this._singleAddRemoveBufferTimeout=null},_checkInGetSeparated:function(r){var t,i,o=this._separateSingleFromGroupLayers(r,{groups:[],singles:[]}),a=o.groups,s=o.singles;for(t=0;t<a.length;t++)i=a[t],this._recruitLayerGroupAsProxy(i);for(t=0;t<s.length;t++)i=s[t],this._removeFromOtherGroupsOrMap(i),this._layers[e.stamp(i)]=i,i._mcgLayerSupportGroup=this;return o},_separateSingleFromGroupLayers:function(r,t){for(var i,o=t.groups,a=t.singles,s=e.Util.isArray,n=0;n<r.length;n++)i=r[n],i instanceof e.LayerGroup?(o.push(i),this._separateSingleFromGroupLayers(i.getLayers(),t)):s(i)?this._separateSingleFromGroupLayers(i,t):a.push(i);return t},_recruitLayerGroupAsProxy:function(r){var t=r._proxyMcgLayerSupportGroup;if(t){if(t===this)return;t.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(t){if(t._proxyMcgLayerSupportGroup!==r&&t._proxyMcgLayerSupportGroup===this){delete t._proxyMcgLayerSupportGroup,t.addLayer=t._originalAddLayer,t.removeLayer=t._originalRemoveLayer;var i=e.stamp(t);delete this._proxyLayerGroups[i],delete this._proxyLayerGroupsNeedRemoving[i],this._removeFromOwnMap(t)}},_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,t=this._layers,i=[];for(var o in t)r=t[o],r._map&&(i.push(r),e._originalRemoveLayer(r));return i},_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 t=e.stamp(r);return this._layers[t]=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 t=e.stamp(r);return this._map&&this._layers[t]&&this._map._originalRemoveLayer(this._layers[t]),delete this._layers[t],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)}};return e.markerClusterGroup.layerSupport=function(e){return new o(e)},o})});
!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)}});
{
"name": "leaflet.markercluster.layersupport",
"_name": "Leaflet.MarkerCluster.LayerSupport",
"version": "1.0.2",
"version": "1.0.3",
"_year": "2015-2016",

@@ -6,0 +6,0 @@ "description": "Sub-plugin for Leaflet.markercluster plugin (MCG in short); brings compatibility with L.Control.Layers and other Leaflet plugins.",

@@ -17,3 +17,5 @@ # Leaflet.MarkerCluster.LayerSupport

Size: 6 kB minified, < 2 kB gzipped.
**NOTE:** _if your usage requires only compatibility of MCG with

@@ -28,8 +30,8 @@ [L.Control.Layers](http://leafletjs.com/reference.html#control-layers),

- [Leaflet.markercluster](https://github.com/Leaflet/Leaflet.markercluster) plugin, version 1.0.0+
- For Leaflet 0.7.x use the [leaflet-0.7 branch](https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport/tree/leaflet-0.7)
- 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)
## Demos
- [LayerSupport with standard L.Control.Layers](http://ghybs.github.io/Leaflet.MarkerCluster.LayerSupport/examples/mcgLayerSupport-controlLayers-realworld.388.html)
- [LayerSupport with LeafletSlider plugin](http://ghybs.github.io/Leaflet.MarkerCluster.LayerSupport/examples/mcgLayerSupport-leafletslider.html)
- [LayerSupport with standard L.Control.Layers](https://ghybs.github.io/Leaflet.MarkerCluster.LayerSupport/examples/mcgLayerSupport-controlLayers-realworld.388.html)
- [LayerSupport with LeafletSlider plugin](https://ghybs.github.io/Leaflet.MarkerCluster.LayerSupport/examples/mcgLayerSupport-leafletslider.html)

@@ -67,3 +69,3 @@

#### Local copy
1. Download the "<a href="https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport/releases/download/v1.0.2/leaflet.markercluster.layersupport.js">`leaflet.markercluster.layersupport.js`</a>" file from the [`v1.0.2` release](https://github.com/ghybs/Leaflet.MarkerCluster.LayerSupport/releases/tag/v1.0.2).
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).
2. Place the file alongside your page.

@@ -77,3 +79,3 @@ 3. Add the `script` tag (see [Quick Guide > HTML](#quick-guide)) to your page after Leaflet and Leaflet.markercluster scripts.

<!-- After Leaflet and Leaflet.markercluster scripts -->
<script src="https://unpkg.com/leaflet.markercluster.layersupport@1.0.2/dist/leaflet.markercluster.layersupport.js"></script>
<script src="https://unpkg.com/leaflet.markercluster.layersupport@1.0.3/dist/leaflet.markercluster.layersupport.js"></script>
```

@@ -80,0 +82,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc