removed dirty flags
This commit is contained in:
parent
69790eb8c7
commit
08ce748a37
@ -26,8 +26,6 @@ OSRM.Marker = function( label, style, position ) {
|
||||
|
||||
this.marker = new L.MouseMarker( this.position, style );
|
||||
this.marker.parent = this;
|
||||
this.dirty_move = true;
|
||||
this.dirty_type = true;
|
||||
|
||||
this.shown = false;
|
||||
this.hint = null;
|
||||
@ -117,7 +115,6 @@ onDrag: function(e) {
|
||||
},
|
||||
onDragStart: function(e) {
|
||||
OSRM.G.dragging = true;
|
||||
this.parent.dirty_move = true;
|
||||
|
||||
// store id of dragged marker
|
||||
for( var i=0; i<OSRM.G.markers.route.length; i++)
|
||||
|
@ -73,9 +73,6 @@ function onclickGeocoderResult(marker_id, lat, lon) {
|
||||
OSRM.G.markers.route[index].show();
|
||||
OSRM.G.markers.route[index].centerView();
|
||||
getRoute(OSRM.C.FULL_DESCRIPTION);
|
||||
|
||||
OSRM.G.markers.route[index].dirty_move = false;
|
||||
OSRM.G.markers.route[index].dirty_type = false;
|
||||
}
|
||||
|
||||
// process JSONP response of geocoder
|
||||
@ -160,13 +157,6 @@ function showReverseGeocoderResults_Timeout(response, parameters) {
|
||||
return;
|
||||
|
||||
updateLocation(parameters.marker_id);
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() ) {
|
||||
OSRM.G.markers.route[0].dirty_move = false;
|
||||
OSRM.G.markers.route[0].dirty_type = false;
|
||||
} else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) {
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_move = false;
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_type = false;
|
||||
}
|
||||
}
|
||||
function showReverseGeocoderResults(response, parameters) {
|
||||
if(!response) {
|
||||
@ -209,13 +199,8 @@ function showReverseGeocoderResults(response, parameters) {
|
||||
}
|
||||
|
||||
// add result to DOM
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() ) {
|
||||
if(parameters.marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
||||
document.getElementById("input-source-name").value = address;
|
||||
OSRM.G.markers.route[0].dirty_move = false;
|
||||
OSRM.G.markers.route[0].dirty_type = false;
|
||||
} else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() ) {
|
||||
else if(parameters.marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
||||
document.getElementById("input-target-name").value = address;
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_move = false;
|
||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_type = false;
|
||||
}
|
||||
}
|
||||
|
@ -471,21 +471,20 @@ function reverseRouting() {
|
||||
|
||||
// click: button "show"
|
||||
function showMarker(marker_id) {
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() && !OSRM.G.markers.route[0].dirty_type ) {
|
||||
if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] )
|
||||
return;
|
||||
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
||||
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) {
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
||||
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;
|
||||
if( marker_id == OSRM.C.SOURCE_LABEL)
|
||||
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;
|
||||
else if( marker_id == OSRM.C.TARGET_LABEL)
|
||||
callGeocoder(OSRM.C.TARGET_LABEL, document.getElementById('input-target-name').value);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user