From 4615b01fdf556ed32d48b77b8bf2f85ac6715468 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Sun, 18 Mar 2012 15:04:17 +0100 Subject: [PATCH] moved inputbox logic to javascript file, corrected error with second ENTER not being registered --- WebContent/main.html | 8 ++++---- WebContent/routing.js | 14 +++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/WebContent/main.html b/WebContent/main.html index 4d7428776..e2787bedb 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -88,14 +88,14 @@ or see http://www.gnu.org/licenses/agpl.txt. - - + + - - + +
Start:ZeigenZeigen
Ende:ZeigenZeigen
diff --git a/WebContent/routing.js b/WebContent/routing.js index 3dec6cb3d..8bd7405ad 100644 --- a/WebContent/routing.js +++ b/WebContent/routing.js @@ -474,10 +474,22 @@ function reverseRouting() { } // click: button "show" -function centerMarker(marker_id) { +function showMarker(marker_id) { if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() && !OSRM.G.markers.route[0].dirty_type ) { OSRM.G.markers.route[0].centerView(); } else if( marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() && !OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_type) { OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView(); } } + + +// changed: any inputbox (is called when return is pressed [after] or focus is lost [before]) +function inputChanged(marker_id) { + if( marker_id == OSRM.C.SOURCE_LABEL){ + if( OSRM.G.markers.hasSource() ) OSRM.G.markers.route[0].dirty_type = true; + callGeocoder(OSRM.C.SOURCE_LABEL, document.getElementById('input-source-name').value); + } else if( marker_id == OSRM.C.TARGET_LABEL) { + if( OSRM.G.markers.hasTarget() ) OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_type = true; + callGeocoder(OSRM.C.TARGET_LABEL, document.getElementById('input-target-name').value); + } +}