diff --git a/WebContent/OSRM.Markers.js b/WebContent/OSRM.Markers.js
index 72191ffb9..707653864 100644
--- a/WebContent/OSRM.Markers.js
+++ b/WebContent/OSRM.Markers.js
@@ -39,8 +39,11 @@ getLng: function() {
isShown: function() {
return this.shown;
},
-centerView: function() {
- map.setView( new L.LatLng( this.position.lat, this.position.lng-0.02), OSRM.DEFAULTS.ZOOM_LEVEL); // dirty hack
+centerView: function(zooming) {
+ var zoom = OSRM.DEFAULTS.ZOOM_LEVEL;
+ if( zooming == false )
+ zoom = map.getZoom();
+ map.setView( new L.LatLng( this.position.lat, this.position.lng-0.02), zoom); // dirty hack
},
toString: function() {
return "OSRM.Marker: \""+this.label+"\", "+this.position+")";
diff --git a/WebContent/geocoder.js b/WebContent/geocoder.js
index b7bd9a617..005726eae 100644
--- a/WebContent/geocoder.js
+++ b/WebContent/geocoder.js
@@ -57,7 +57,7 @@ function showGeocoderResults(marker_id, response) {
html += '
';
if(result.display_name){
- html += ' '+result.display_name+' ';
+ html += ''+result.display_name+' ';
}
html += " | ";
}
diff --git a/WebContent/main.js b/WebContent/main.js
index 58e0eb9c6..2add3cfbf 100644
--- a/WebContent/main.js
+++ b/WebContent/main.js
@@ -122,7 +122,21 @@ function initMap() {
map.setView( new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE-0.02), OSRM.DEFAULTS.ZOOM_LEVEL);
map.on('zoomend', function(e) { getRoute(OSRM.FULL_DESCRIPTION); });
- // onmousemove test
+ map.on('click', function(e) {
+ if( !my_markers.route[0] || my_markers.route[0].label != OSRM.SOURCE_MARKER_LABEL) {
+ index = my_markers.setSource( e.latlng );
+ my_markers.route[index].show();
+ my_markers.route[index].centerView(false);
+ getRoute(OSRM.FULL_DESCRIPTION);
+ }
+ else if( !my_markers.route[my_markers.route.length-1] || my_markers.route[ my_markers.route.length-1 ].label != OSRM.TARGET_MARKER_LABEL) {
+ index = my_markers.setTarget( e.latlng );
+ my_markers.route[index].show();
+ my_markers.route[index].centerView(false);
+ getRoute(OSRM.FULL_DESCRIPTION);
+ }
+ } );
+ // onmousemove test
// map.on('mousemove', function(e) { console.log("pos: " + e.latlng); });
// map.on('mousemove', function(e) {
// var objs = new Array;
diff --git a/WebContent/routing.js b/WebContent/routing.js
index fb6575898..4d4d86ea3 100644
--- a/WebContent/routing.js
+++ b/WebContent/routing.js
@@ -130,6 +130,7 @@ function showRouteDescription(response) {
// create link to the route
var route_link ='['+OSRM.loc("GET_LINK")+']';
+ //var route_link ='['+OSRM.loc("GET_LINK")+']';
// create GPX link
var gpx_link = '['+OSRM.loc("GPX_FILE")+']';
@@ -308,8 +309,8 @@ function startRouting() {
}
function resetRouting() {
- //document.getElementById('input-source-name').value = "";
- //document.getElementById('input-target-name').value = "";
+ document.getElementById('input-source-name').value = "";
+ document.getElementById('input-target-name').value = "";
my_route.hideRoute();
my_markers.removeAll();