camptocamp/cgxp — pull request #461 by asaunier (2013-05-22 13:47:05+00:00)
Title: Optimization of the base layer detection in MapOpacitySlider

As for now:
1. the base layer is set (to the default base layer set in the plugin's config) at init time of the MapOpacitySlider widget.
2. if state parameters are then detected, the base layer is updated again so that the one provided in the state is used.

This means that when a state is provided, the baselayer will be set twice. If the baselayer is not the same in both cases, tiles from the first baselayer will be loaded whereas only the ones of the finally set baselayer will be displayed.

This PR suggests that the baselayer is set only once, after the state parameters are detected, using a "beforerender" event.