Merge pull request #49 from bagage/master
Use leaflet.restoreview.js plugin to save and restore last user's map…
This commit is contained in:
commit
c9cd0850fd
6 changed files with 82 additions and 69 deletions
|
|
@ -20,7 +20,9 @@
|
||||||
"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",
|
||||||
|
"leaflet.locatecontrol": "^0.52.0"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"leaflet": {
|
"leaflet": {
|
||||||
|
|
@ -79,6 +81,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
96
dist/brouter-web.js
vendored
96
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
12
index.html
12
index.html
|
|
@ -38,7 +38,7 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id="tabs_div" class="hidden">
|
<div id="tabs_div" class="hidden">
|
||||||
|
|
||||||
<ul id="tab" class="nav nav-tabs" role="tablist">
|
<ul id="tab" class="nav nav-tabs" role="tablist">
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
Online service of the BRouter routing engine. For the offline Android app and more information see <a href="http://brouter.de/" target="_blank">brouter.de</a>.
|
Online service of the BRouter routing engine. For the offline Android app and more information see <a href="http://brouter.de/" target="_blank">brouter.de</a>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<i>Work in progress:</i> The web client is still in (slow) development; it has some glitches,
|
<i>Work in progress:</i> The web client is still in (slow) development; it has some glitches,
|
||||||
you might miss some essential features and stumble upon bugs. The user interface is subject to change.
|
you might miss some essential features and stumble upon bugs. The user interface is subject to change.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -93,12 +93,12 @@
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<i>Data:</i> based on <a href="http://www.openstreetmap.org" target="_blank">OpenStreetMap</a>. It is usually updated once a week when a new Planet file is available,
|
<i>Data:</i> based on <a href="http://www.openstreetmap.org" target="_blank">OpenStreetMap</a>. It is usually updated once a week when a new Planet file is available,
|
||||||
see dates of <a href="http://brouter.de/brouter/segments4/" target="_blank">data files</a>.
|
see dates of <a href="http://brouter.de/brouter/segments4/" target="_blank">data files</a>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<i><a href="https://github.com/nrenner/brouter-web#credits-and-licenses" target="_blank">Credits</a></i>,
|
<i><a href="https://github.com/nrenner/brouter-web#credits-and-licenses" target="_blank">Credits</a></i>,
|
||||||
<i><a href="https://github.com/nrenner/brouter-web/blob/master/CHANGELOG.md" target="_blank">Changelog</a></i> and
|
<i><a href="https://github.com/nrenner/brouter-web/blob/master/CHANGELOG.md" target="_blank">Changelog</a></i> and
|
||||||
<i><a href="https://github.com/nrenner/brouter-web#readme" target="_blank">more info</a></i> on the client.
|
<i><a href="https://github.com/nrenner/brouter-web#readme" target="_blank">more info</a></i> on the client.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -106,7 +106,7 @@
|
||||||
<script>
|
<script>
|
||||||
// global package prefix for BRouter web application
|
// global package prefix for BRouter web application
|
||||||
BR = {};
|
BR = {};
|
||||||
|
|
||||||
console.log('\r\n###\r\n### BRouter-Web\r\n###\r\n### Please note that the routing API used here is not public!\r\n###\r\n');
|
console.log('\r\n###\r\n### BRouter-Web\r\n###\r\n### Please note that the routing API used here is not public!\r\n###\r\n');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
22
js/index.js
22
js/index.js
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
BRouter web - web client for BRouter bike routing engine
|
BRouter web - web client for BRouter bike routing engine
|
||||||
|
|
||||||
Licensed under the MIT license.
|
Licensed under the MIT license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
function initMap() {
|
function initMap() {
|
||||||
L.Icon.Default.imagePath = 'dist/images';
|
L.Icon.Default.imagePath = 'dist/images';
|
||||||
|
|
||||||
var osmAttribution = '© <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
var osmAttribution = '© <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
|
||||||
var maxZoom = 19;
|
var maxZoom = 19;
|
||||||
|
|
||||||
|
|
@ -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 '
|
||||||
|
|
@ -121,9 +122,9 @@
|
||||||
var search,
|
var search,
|
||||||
router,
|
router,
|
||||||
routing,
|
routing,
|
||||||
routesLayer,
|
routesLayer,
|
||||||
routingOptions,
|
routingOptions,
|
||||||
nogos,
|
nogos,
|
||||||
stats,
|
stats,
|
||||||
itinerary,
|
itinerary,
|
||||||
elevation,
|
elevation,
|
||||||
|
|
@ -139,6 +140,11 @@
|
||||||
// left sidebar as additional control position
|
// left sidebar as additional control position
|
||||||
map._controlCorners[leftPaneId] = L.DomUtil.create('div', 'leaflet-' + leftPaneId, map._controlContainer);
|
map._controlCorners[leftPaneId] = L.DomUtil.create('div', 'leaflet-' + leftPaneId, map._controlContainer);
|
||||||
|
|
||||||
|
L.control.locate({
|
||||||
|
icon: 'glyphicon glyphicon-screenshot',
|
||||||
|
iconLoading: 'glyphicon glyphicon-refresh',
|
||||||
|
}).addTo(map);
|
||||||
|
|
||||||
document.getElementById('about_link').onclick = function() {
|
document.getElementById('about_link').onclick = function() {
|
||||||
bootbox.alert({
|
bootbox.alert({
|
||||||
title: 'About',
|
title: 'About',
|
||||||
|
|
@ -182,7 +188,7 @@
|
||||||
function requestUpdate(updatable) {
|
function requestUpdate(updatable) {
|
||||||
var track = routing.toPolyline(),
|
var track = routing.toPolyline(),
|
||||||
segments = routing.getSegments();
|
segments = routing.getSegments();
|
||||||
|
|
||||||
updatable.update(track, segments);
|
updatable.update(track, segments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue