diff --git a/front/src/Url/UrlManager.ts b/front/src/Url/UrlManager.ts index 0833919a..cb0e1ed0 100644 --- a/front/src/Url/UrlManager.ts +++ b/front/src/Url/UrlManager.ts @@ -45,21 +45,28 @@ class UrlManager { } public getStartLayerNameFromUrl(): string | null { - const hash = window.location.hash; - let layerName = null; - if (hash.length > 1) { - layerName = hash.includes("&") ? hash.split("&")[0].substring(1) : hash.substring(1); + const parameters = this.getHashParameters(); + for (const key in parameters) { + if (parameters[key] === undefined) { + return key; + } } - return layerName; + return null; } public getHashParameter(name: string): string | undefined { - const parameters = window.location.hash.split("&").reduce((res: Record, item: string) => { - const parts = item.split("="); - res[parts[0]] = parts[1]; - return res; - }, {}); - return parameters[name]; + return this.getHashParameters()[name]; + } + + private getHashParameters(): Record { + return window.location.hash + .substring(1) + .split("&") + .reduce((res: Record, item: string) => { + const parts = item.split("="); + res[parts[0]] = parts[1]; + return res; + }, {}); } pushStartLayerNameToUrl(startLayerName: string): void { diff --git a/maps/tests/move_to.json b/maps/tests/move_to.json index 2fdabab0..39be809b 100644 --- a/maps/tests/move_to.json +++ b/maps/tests/move_to.json @@ -44,6 +44,12 @@ "id":8, "name":"exit", "opacity":1, + "properties":[ + { + "name":"startLayer", + "type":"bool", + "value":true + }], "type":"tilelayer", "visible":true, "width":10,