Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use leaflet.restoreview.js plugin to save and restore last user's map… #49

Merged
merged 2 commits into from
Jul 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"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",
"leaflet.locatecontrol": "^0.52.0"
},
"overrides": {
"leaflet": {
Expand Down Expand Up @@ -79,6 +81,9 @@
},
"url-search-params": {
"main": "build/url-search-params.js"
},
"Leaflet.RestoreView": {
"main": "leaflet.restoreview.js"
}
},
"resolutions": {
Expand Down
12 changes: 6 additions & 6 deletions dist/brouter-web.css

Large diffs are not rendered by default.

96 changes: 49 additions & 47 deletions dist/brouter-web.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/brouter-web.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</table>
</div>
<div id="tabs_div" class="hidden">

<ul id="tab" class="nav nav-tabs" role="tablist">
</ul>

Expand Down Expand Up @@ -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>.
</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.
</p>
<p>
Expand All @@ -93,20 +93,20 @@
</ul>
</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>.
</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/blob/master/CHANGELOG.md" target="_blank">Changelog</a></i> and
<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#readme" target="_blank">more info</a></i> on the client.
</p>
</div>

<script>
// global package prefix for BRouter web application
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');
</script>

Expand Down
22 changes: 14 additions & 8 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
BRouter web - web client for BRouter bike routing engine

Licensed under the MIT license.
*/

Expand All @@ -11,7 +11,7 @@

function initMap() {
L.Icon.Default.imagePath = 'dist/images';

var osmAttribution = '&copy; <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';
var maxZoom = 19;

Expand Down Expand Up @@ -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> &copy; Arndt Brenschede, '
+ 'routing + map data &copy; <a target="_blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors '
Expand Down Expand Up @@ -121,9 +122,9 @@
var search,
router,
routing,
routesLayer,
routingOptions,
nogos,
routesLayer,
routingOptions,
nogos,
stats,
itinerary,
elevation,
Expand All @@ -139,6 +140,11 @@
// left sidebar as additional control position
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() {
bootbox.alert({
title: 'About',
Expand Down Expand Up @@ -182,7 +188,7 @@
function requestUpdate(updatable) {
var track = routing.toPolyline(),
segments = routing.getSegments();

updatable.update(track, segments);
}

Expand Down