mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Add hasLayer support. Not super efficient n(log n) IIRC, but at least we have one! Refs #44
This commit is contained in:
@@ -110,6 +110,20 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
return this;
|
||||
},
|
||||
|
||||
hasLayer: function (layer) {
|
||||
var res = false;
|
||||
|
||||
this._topClusterLevel._recursively(new L.LatLngBounds([layer.getLatLng()]), 0, this._map.getMaxZoom() + 1,
|
||||
function (cluster) {
|
||||
for (var i = cluster._markers.length - 1; i >= 0 && !res; i--) {
|
||||
if (cluster._markers[i] === layer) {
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
return res;
|
||||
},
|
||||
|
||||
//Overrides FeatureGroup.onAdd
|
||||
onAdd: function (map) {
|
||||
L.FeatureGroup.prototype.onAdd.call(this, map);
|
||||
|
||||
Reference in New Issue
Block a user