Reset state when changing style

Switch styles, and choose whether the SDK module state comes along (resetState)

View on GitHub
SDK 1.0.0-rc.7

A route, its waypoints, place pins, filtered POIs and incidents share one map. Switch style with the box ticked and they go. Leave it clear and they stay drawn, taking on the new style’s look.

  • setStyle takes { resetState } as its second argument. If it’s false, the modules carry their layers and data onto the new style. If it’s true, they start clean.
  • RoutingModule.showRoutes, showWaypoints and PlacesModule.show are each given their service response once, never again across style switches.
  • The filters handed to POIsModule.get and TrafficIncidentsModule.get come along too, so the new style is filtered the same way.

Related examples