diff --git a/src/components/AppMap.ts b/src/components/AppMap.ts index 6802a61..d563421 100644 --- a/src/components/AppMap.ts +++ b/src/components/AppMap.ts @@ -348,6 +348,9 @@ export default class AppMap extends mixins(MixinUtil) { zoom = 3; this.map.setView([x, 0, z], zoom); + const layer = route.params.layer; + if (layer && ["Surface", "Depths", "Sky"].includes(layer)) + this.map.switchBaseTileLayer(layer); } updateRoute() { this.updatingRoute = true; @@ -358,6 +361,7 @@ export default class AppMap extends mixins(MixinUtil) { x: this.map.center[0], z: this.map.center[2], zoom: this.map.m.getZoom(), + layer: this.map.activeLayer, }, query: this.$route.query, }).catch(err => { @@ -379,6 +383,7 @@ export default class AppMap extends mixins(MixinUtil) { this.map.registerBaseLayerChangeCb(() => { this.updateMarkers(); this.updateDrawLayers(); + this.updateRoute(); }); } diff --git a/src/router.ts b/src/router.ts index c3aba16..c1c75e9 100644 --- a/src/router.ts +++ b/src/router.ts @@ -9,6 +9,11 @@ export default new Router({ // mode: 'history', routes: [ { path: '/map', redirect: '/map/zx,0,0' }, + { + path: '/map/z:zoom,:x,:z,:layer', + name: 'map', + component: AppMap, + }, { path: '/map/z:zoom,:x,:z', name: 'map',