Trigger Map Initialize on Layout Change?
Is there a way to trigger the map initialize event when a layout is swapped? The map init event will fire on first layout swap but not on any others. I don't think there is a command but is there a way to trip it off via the Web SDK by maybe updating a parameter on the map model?
Use case, due to layer count in our apps map, I can't keep my web map and scene contained within the same mapping component - its entirely to many requests to have user load.
My thinking is, lets break them out into two layouts - 2D and 3D - and have a button to swap between 2D and 3D with a viewer.load-layout. Easy enough, but the problem is, If I load 2D, the 2D map init event is fired - cool, I go to switch to 3D, and the 3D map init event will fire - cool. If I swap back to 2D from 3D after the above, the 2D map init does not fire - not cool.
I need the map init event to run a workflow that does some final setup for the viewer. I've tried attaching my map init wf onto the layout loaded event but that borks the designer page since the message bus can't load.
-
Think I've figured this out creating 3 custom commands:
1) map.remove-web-scene: Store OG scene in state and remove the web scene from the map extension
2) map.swap-2D: Run a switchViewMode to map
3) map.swap-3D: Add web scene back to the map extension and run a switchViewMode to scene
With #1, storing and remove the scene from the map extensions kills the excessive requests I was getting under the hood. We take a hit on load when doing #3 but that's just the nature of the beast and can live with that.
Command #1 gets run on the map init event. Buttons can now run cmds #2 and #3.
I'd like to also remove the web map during cmd #3 but in doing so, it breaks the layer list component.0 -
I'm looking to implement something similar behavior. Please let me know more details about getting this sorted out.
Thanks0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
2 kommentarer