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
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