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": "*",
|
||||
"bootbox": "~4.4.0",
|
||||
"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": {
|
||||
"leaflet": {
|
||||
|
|
@ -79,6 +80,9 @@
|
|||
},
|
||||
"url-search-params": {
|
||||
"main": "build/url-search-params.js"
|
||||
},
|
||||
"Leaflet.RestoreView": {
|
||||
"main": "leaflet.restoreview.js"
|
||||
}
|
||||
},
|
||||
"resolutions": {
|
||||
|
|
|
|||
12
dist/brouter-web.css
vendored
12
dist/brouter-web.css
vendored
File diff suppressed because one or more lines are too long
95
dist/brouter-web.js
vendored
95
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
17
js/index.js
17
js/index.js
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
BRouter web - web client for BRouter bike routing engine
|
||||
|
||||
|
||||
Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
function initMap() {
|
||||
L.Icon.Default.imagePath = 'dist/images';
|
||||
|
||||
|
||||
var osmAttribution = '© <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||
var maxZoom = 19;
|
||||
|
||||
|
|
@ -74,10 +74,11 @@
|
|||
});
|
||||
|
||||
map = new L.Map('map', {
|
||||
center: new L.LatLng(50.99, 9.86),
|
||||
zoom: 6,
|
||||
worldCopyJump: true
|
||||
});
|
||||
if (!map.restoreView()) {
|
||||
map.setView([50.99, 9.86], 6);
|
||||
}
|
||||
map.attributionControl.addAttribution(
|
||||
'<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 '
|
||||
|
|
@ -121,9 +122,9 @@
|
|||
var search,
|
||||
router,
|
||||
routing,
|
||||
routesLayer,
|
||||
routingOptions,
|
||||
nogos,
|
||||
routesLayer,
|
||||
routingOptions,
|
||||
nogos,
|
||||
stats,
|
||||
itinerary,
|
||||
elevation,
|
||||
|
|
@ -182,7 +183,7 @@
|
|||
function requestUpdate(updatable) {
|
||||
var track = routing.toPolyline(),
|
||||
segments = routing.getSegments();
|
||||
|
||||
|
||||
updatable.update(track, segments);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue