Using MapSuite MVC 7.0, we’ve been having an issue with clicking to zoom on a map in that when a user clicked the map, it would zoom correctly and then zoom back out to the original extent after a short delay. We traced this back to the fact that other maps were loading synchronously and, each time the next map loaded it triggered previously created maps to be created yet again. For example:
- Map 1 loads, calls CreateAllMaps() function within script returned by helper_GeoResource.axd. CreateAllMaps() executes with MultiMap value = {cMap1}
- Map 2 URL is called and, while it’s loading, user clicks Map 1 to zoom in.
- Map 1 zooms in per user click.
- Map 2 loads and calls CreateAllMaps(). CreateAllMaps executes with MultiMap value = { cMap2 }
- CreateAllMaps fires yet again, this time with MultiMap now = {cMap1, cMap2}. At which point CreateAllMaps() calls parser.createMap() for cMap1 it causes the users specified zoom to go back to the default zoom.
- This process continues with subsequent maps, meaning when MapN loads, CreateAllMaps() runs one for MapN and then again for {Map1, Map2, Map3, …MapN}.
We are loading the maps into the page by using jQuery ajax call and putting returned html of map partial into div container using $(‘containerId’).html(mapPartialContent). We put a 2-second delay between maps because loading 4 maps without the delay caused the first map to have ‘pink tiles’. This may also be related to maps being created multiple times.
Is there a way to prevent this behavior?