diff --git a/WebContent/base/osrm/OSRM.Marker.js b/WebContent/base/osrm/OSRM.Marker.js index 6df6ffcfa..6c1501fea 100644 --- a/WebContent/base/osrm/OSRM.Marker.js +++ b/WebContent/base/osrm/OSRM.Marker.js @@ -38,6 +38,14 @@ show: function() { hide: function() { OSRM.G.map.removeLayer(this.marker); this.shown = false; + + // revert highlighted description + if( this.label == "highlight" ) + if( this.description ) { + var desc = document.getElementById("description-"+this.description); + desc && (desc.className = "description-body-item"); + this.description = null; + } }, setPosition: function( position ) { this.position = position; diff --git a/WebContent/main.css b/WebContent/main.css index 51569cbd8..c25deda89 100644 --- a/WebContent/main.css +++ b/WebContent/main.css @@ -393,11 +393,16 @@ html, body .description-body-item { cursor:pointer; - color:#000000 + color:#000000; } .description-body-item:hover { - color:#ff0000 + color:#ff0000; +} +.description-body-item-selected +{ + cursor:pointer; + color:#ff00ff; } /* ------------------------------------------------------------------------ */ diff --git a/WebContent/routing/OSRM.RoutingDescription.js b/WebContent/routing/OSRM.RoutingDescription.js index 2bc47b7d7..d56b50845 100644 --- a/WebContent/routing/OSRM.RoutingDescription.js +++ b/WebContent/routing/OSRM.RoutingDescription.js @@ -43,10 +43,13 @@ onMouseOverRouteDescription: function(lat, lng) { onMouseOutRouteDescription: function(lat, lng) { OSRM.G.markers.hover.hide(); }, -onClickRouteDescription: function(lat, lng) { +onClickRouteDescription: function(lat, lng, desc) { OSRM.G.markers.highlight.setPosition( new L.LatLng(lat, lng) ); OSRM.G.markers.highlight.show(); OSRM.G.markers.highlight.centerView(OSRM.DEFAULTS.HIGHLIGHT_ZOOM_LEVEL); + + OSRM.G.markers.highlight.description = desc; + document.getElementById("description-"+desc).className = "description-body-item description-body-item-selected"; }, onClickCreateShortcut: function(src){ src += '&z='+ OSRM.G.map.getZoom() + '¢er=' + OSRM.G.map.getCenter().lat.toFixed(6) + ',' + OSRM.G.map.getCenter().lng.toFixed(6); @@ -94,6 +97,12 @@ show: function(response) { // create GPX link var gpx_link = '['+OSRM.loc("GPX_FILE")+']'; + + // check highlight marker to get id of corresponding description + // [works as changing language or metric does not remove the highlight marker!] + var selected_description = null; + if( OSRM.G.markers.highlight.isShown() ) + selected_description = OSRM.G.markers.highlight.description; // create route description var positions = OSRM.G.route.getPositions(); @@ -112,8 +121,8 @@ show: function(response) { body += ''; var pos = positions[response.route_instructions[i][3]]; - body += '
';