changed behaviour of geocoder (return always triggers geocoder, moving a
single marker clears search results)
This commit is contained in:
parent
0fd8d4d8cf
commit
213bb71b35
@ -37,10 +37,12 @@ init: function() {
|
||||
document.getElementById("gui-printer").onclick = OSRM.Printing.print;
|
||||
|
||||
document.getElementById("gui-input-source").onchange = function() {OSRM.RoutingGUI.inputChanged(OSRM.C.SOURCE_LABEL);};
|
||||
document.getElementById("gui-input-source").onkeyup = function(e) {OSRM.RoutingGUI.keyUp(e,OSRM.C.SOURCE_LABEL);};
|
||||
document.getElementById("gui-delete-source").onclick = function() {OSRM.RoutingGUI.deleteMarker(OSRM.C.SOURCE_LABEL);};
|
||||
document.getElementById("gui-search-source").onclick = function() {OSRM.RoutingGUI.showMarker(OSRM.C.SOURCE_LABEL);};
|
||||
|
||||
document.getElementById("gui-input-target").onchange = function() {OSRM.RoutingGUI.inputChanged(OSRM.C.TARGET_LABEL);};
|
||||
document.getElementById("gui-input-target").onkeyup = function(e) {OSRM.RoutingGUI.keyUp(e,OSRM.C.TARGET_LABEL);};
|
||||
document.getElementById("gui-delete-target").onclick = function() {OSRM.RoutingGUI.deleteMarker(OSRM.C.TARGET_LABEL);};
|
||||
document.getElementById("gui-search-target").onclick = function() {OSRM.RoutingGUI.showMarker(OSRM.C.TARGET_LABEL);};
|
||||
|
||||
@ -49,6 +51,7 @@ init: function() {
|
||||
document.getElementById("gui-options-toggle").onclick = OSRM.GUI.toggleOptions;
|
||||
document.getElementById("open-josm").onclick = OSRM.RoutingGUI.openJOSM;
|
||||
document.getElementById("open-osmbugs").onclick = OSRM.RoutingGUI.openOSMBugs;
|
||||
document.getElementById("option-highlight-nonames").onclick = OSRM.Routing.getRoute;
|
||||
|
||||
// gui after transition events
|
||||
if( OSRM.Browser.FF3==-1 && OSRM.Browser.IE6_9==-1 ) {
|
||||
|
@ -60,7 +60,8 @@ _onclickResult: function(marker_id, lat, lon) {
|
||||
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView();
|
||||
OSRM.Routing.getRoute();
|
||||
if( OSRM.G.markers.route.length > 1 )
|
||||
OSRM.Routing.getRoute();
|
||||
},
|
||||
|
||||
|
||||
@ -76,6 +77,11 @@ _showResults: function(response, parameters) {
|
||||
return;
|
||||
}
|
||||
|
||||
// show first result
|
||||
OSRM.Geocoder._onclickResult(parameters.marker_id, response[0].lat, response[0].lon);
|
||||
if( OSRM.G.markers.route.length > 1 )
|
||||
return;
|
||||
|
||||
// show possible results for input
|
||||
var html = "";
|
||||
html += '<table class="results-table medium-font">';
|
||||
@ -101,8 +107,6 @@ _showResults: function(response, parameters) {
|
||||
"<div class='header-title'>"+OSRM.loc("SEARCH_RESULTS")+"</div>" +
|
||||
"<div class='header-content'>(found "+response.length+" results)"+"</div>";
|
||||
document.getElementById('information-box').innerHTML = html;
|
||||
|
||||
OSRM.Geocoder._onclickResult(parameters.marker_id, response[0].lat, response[0].lon);
|
||||
},
|
||||
_showResults_Empty: function(parameters) {
|
||||
document.getElementById('information-box-header').innerHTML =
|
||||
|
@ -118,14 +118,15 @@ onDragEnd: function(e) {
|
||||
this.switchIcon(this.options.baseicon);
|
||||
|
||||
this.parent.setPosition( e.target.getLatLng() );
|
||||
OSRM.Routing.getRoute();
|
||||
if (OSRM.G.route.isShown()) {
|
||||
OSRM.Routing.getRoute();
|
||||
OSRM.G.route.hideOldRoute();
|
||||
OSRM.G.route.hideUnnamedRoute();
|
||||
}
|
||||
|
||||
if(OSRM.G.route.isShown()==false)
|
||||
} else {
|
||||
OSRM.Geocoder.updateAddress(this.parent.label);
|
||||
document.getElementById('information-box').innerHTML = ""; // do we want this?
|
||||
document.getElementById('information-box-header').innerHTML = "";
|
||||
}
|
||||
},
|
||||
toString: function() {
|
||||
return "OSRM.RouteMarker: \""+this.label+"\", "+this.position+")";
|
||||
|
@ -109,7 +109,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
<div id="input-target" class="input-marker">
|
||||
<div class="left"><span id="gui-search-target-label">Ende:</span></div>
|
||||
<div class="center input-box"><input id="gui-input-target" class="input-box" type="text" maxlength="200" value="" title="Zielposition eingeben" /></div>
|
||||
<div class="center"><div id="fui-delete-target" class="iconic-button delete-marker"></div></div>
|
||||
<div class="center"><div id="gui-delete-target" class="iconic-button delete-marker"></div></div>
|
||||
<div class="right"><a class="button" id="gui-search-target">Zeigen</a></div>
|
||||
</div>
|
||||
</div>
|
||||
@ -129,12 +129,12 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
<div id="input-mask-options">
|
||||
|
||||
<!-- option toggle -->
|
||||
<span id="options-toggle" class="small-font">Kartenwerkzeuge</span>
|
||||
<span id="gui-options-toggle" class="small-font">Kartenwerkzeuge</span>
|
||||
|
||||
<!-- actual options -->
|
||||
<div id="options-box" class="full">
|
||||
<div class="left">
|
||||
<input type="checkbox" id="option-highlight-nonames" value="highlight-nonames" onclick="OSRM.Routing.getRoute();" />
|
||||
<input type="checkbox" id="option-highlight-nonames" value="highlight-nonames" />
|
||||
<span id="gui-option-highlight-nonames-label" class="checkbox-label small-font">Unbenannte Straßen hervorheben</span>
|
||||
</div>
|
||||
<div class="right">
|
||||
|
@ -83,7 +83,16 @@ showMarker: function(marker_id) {
|
||||
},
|
||||
|
||||
|
||||
// changed: any inputbox (is called when return is pressed [after] or focus is lost [before])
|
||||
// keyup: force geocoder when enter is pressed
|
||||
// (change event can be triggered, too; second call to geocoder gets fenced by JSONP)
|
||||
// (alternative: track changes manually and only permit keyup event, if there was no change)
|
||||
// do we want this?
|
||||
keyUp: function(e, marker_id) {
|
||||
if(e.keyCode==13)
|
||||
OSRM.RoutingGUI.inputChanged(marker_id);
|
||||
},
|
||||
|
||||
// changed: any inputbox (is called when enter is pressed [after] or focus is lost [before])
|
||||
inputChanged: function(marker_id) {
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL)
|
||||
OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('gui-input-source').value);
|
||||
|
Loading…
Reference in New Issue
Block a user