Support optional and custom layers in hash URL

- extend layer control to get current active layers (and more)
- access layer control in hash instead of static initial list
- use ',' layer separator and encode layers individually, so that comma
in layer name gets encoded and is not mistaken as separator as with '-'
This commit is contained in:
Norbert Renner 2019-03-29 22:20:52 +01:00
parent dbc7fce91d
commit d83ffa3fbc
5 changed files with 101 additions and 74 deletions

View file

@ -19,7 +19,6 @@
function initApp(mapContext) {
var map = mapContext.map,
layersControl = mapContext.layersControl,
mapLayers = mapContext.layers,
search,
router,
routing,
@ -311,9 +310,9 @@
};
urlHash.onHashChangeCb = onHashChangeCb;
urlHash.onInvalidHashChangeCb = onInvalidHashChangeCb;
urlHash.layers = mapLayers;
urlHash.map = map;
urlHash.init(map, mapLayers);
urlHash.init(map, {
layersControl: layersControl
});
routingOptions.on('update', urlHash.onMapMove, urlHash);
nogos.on('update', urlHash.onMapMove, urlHash);