Skip to content

Instantly share code, notes, and snippets.

@jeff-hager-dev
Created June 4, 2018 20:04
Show Gist options
  • Select an option

  • Save jeff-hager-dev/cc7c72060616d2d461ad841b1fa343f0 to your computer and use it in GitHub Desktop.

Select an option

Save jeff-hager-dev/cc7c72060616d2d461ad841b1fa343f0 to your computer and use it in GitHub Desktop.
[Spiderifying Clustered Layers in Mapbox-GL: Unspidering the data] #geospark-blog-post
map.on('click', closeSpideredFeatures);
function closeSpideredFeatures(e) {
if (e.originalEvent.target.className.indexOf('spider') <= -1) {
var mapContainer = e.target._container.id;
unspiderFeatures(mapContainer);
}
}
function unspiderFeatures(mapContainer) {
if (spiderifier) {
spiderifier.unspiderfy();
spiderifier = null;
map.off('click', closeSpideredFeatures);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment