Use leaflet.restoreview.js plugin to save and restore last user's map position between sessions (#48)
This commit is contained in:
parent
42d04e52c2
commit
66abb83c60
5 changed files with 69 additions and 63 deletions
|
|
@ -20,7 +20,8 @@
|
||||||
"Leaflet.EasyButton": "*",
|
"Leaflet.EasyButton": "*",
|
||||||
"bootbox": "~4.4.0",
|
"bootbox": "~4.4.0",
|
||||||
"seiyria-bootstrap-slider": "~4.8.1",
|
"seiyria-bootstrap-slider": "~4.8.1",
|
||||||
"url-search-params": "~0.5.0"
|
"url-search-params": "~0.5.0",
|
||||||
|
"Leaflet.RestoreView": "makinacorpus/Leaflet.RestoreView#master"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"leaflet": {
|
"leaflet": {
|
||||||
|
|
@ -79,6 +80,9 @@
|
||||||
},
|
},
|
||||||
"url-search-params": {
|
"url-search-params": {
|
||||||
"main": "build/url-search-params.js"
|
"main": "build/url-search-params.js"
|
||||||
|
},
|
||||||
|
"Leaflet.RestoreView": {
|
||||||
|
"main": "leaflet.restoreview.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|
|
||||||
12
dist/brouter-web.css
vendored
12
dist/brouter-web.css
vendored
File diff suppressed because one or more lines are too long
93
dist/brouter-web.js
vendored
93
dist/brouter-web.js
vendored
File diff suppressed because one or more lines are too long
2
dist/brouter-web.js.map
vendored
2
dist/brouter-web.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -74,10 +74,11 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
map = new L.Map('map', {
|
map = new L.Map('map', {
|
||||||
center: new L.LatLng(50.99, 9.86),
|
|
||||||
zoom: 6,
|
|
||||||
worldCopyJump: true
|
worldCopyJump: true
|
||||||
});
|
});
|
||||||
|
if (!map.restoreView()) {
|
||||||
|
map.setView([50.99, 9.86], 6);
|
||||||
|
}
|
||||||
map.attributionControl.addAttribution(
|
map.attributionControl.addAttribution(
|
||||||
'<a href="http://brouter.de/brouter" target="_blank">BRouter</a> © Arndt Brenschede, '
|
'<a href="http://brouter.de/brouter" target="_blank">BRouter</a> © Arndt Brenschede, '
|
||||||
+ 'routing + map data © <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors '
|
+ 'routing + map data © <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors '
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue