Last active
August 3, 2023 17:00
-
-
Save carmoreira/4af1a95ed0f285e666fac2bc49b862c1 to your computer and use it in GitHub Desktop.
Show all overlay series after specific zoom level - Interactive Geo Maps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mapID = 11111; // replace with your map ID | |
let igmNow = Date.now(); | |
let igmZoomLevel = 3; | |
mapContainer.addEventListener('mapready', function(ev) { | |
let igmap = iMaps.maps[mapID].map; | |
igmap.events.on("zoomlevelchanged", function(ev) { | |
if( Date.now() >= igmNow + 500){ | |
let series = iMaps.maps[mapID].series; | |
series.forEach(function(serie) { | |
if( iMaps.maps[mapID].allBaseSeries.includes( serie ) ){ return; } | |
if (igmap.zoomLevel >= igmZoomLevel) { | |
serie.show(); | |
} else { | |
serie.hide(); | |
} | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment