added temporary marker when hovering over a route description
This commit is contained in:
parent
e9a31746b6
commit
ce1db933f3
@ -21,6 +21,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
OSRM.Markers = function() {
|
OSRM.Markers = function() {
|
||||||
this.route = new Array();
|
this.route = new Array();
|
||||||
this.highlight = new OSRM.DragMarker("highlight", {zIndexOffset:-1,draggable:true,icon:OSRM.G.icons['marker-highlight'],dragicon:OSRM.G.icons['marker-highlight-drag']});;
|
this.highlight = new OSRM.DragMarker("highlight", {zIndexOffset:-1,draggable:true,icon:OSRM.G.icons['marker-highlight'],dragicon:OSRM.G.icons['marker-highlight-drag']});;
|
||||||
|
this.hover = new OSRM.Marker("hover", {zIndexOffset:-1,draggable:false,icon:OSRM.G.icons['marker-highlight']});;
|
||||||
this.dragger = new OSRM.DragMarker("drag", {draggable:true,icon:OSRM.G.icons['marker-drag'],dragicon:OSRM.G.icons['marker-drag']});;
|
this.dragger = new OSRM.DragMarker("drag", {draggable:true,icon:OSRM.G.icons['marker-drag'],dragicon:OSRM.G.icons['marker-drag']});;
|
||||||
};
|
};
|
||||||
OSRM.extend( OSRM.Markers,{
|
OSRM.extend( OSRM.Markers,{
|
||||||
|
@ -35,6 +35,14 @@ uninit: function() {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// route description events
|
// route description events
|
||||||
|
onMouseOverRouteDescription: function(lat, lng) {
|
||||||
|
OSRM.G.markers.hover.setPosition( new L.LatLng(lat, lng) );
|
||||||
|
OSRM.G.markers.hover.show();
|
||||||
|
|
||||||
|
},
|
||||||
|
onMouseOutRouteDescription: function(lat, lng) {
|
||||||
|
OSRM.G.markers.hover.hide();
|
||||||
|
},
|
||||||
onClickRouteDescription: function(lat, lng) {
|
onClickRouteDescription: function(lat, lng) {
|
||||||
OSRM.G.markers.highlight.setPosition( new L.LatLng(lat, lng) );
|
OSRM.G.markers.highlight.setPosition( new L.LatLng(lat, lng) );
|
||||||
OSRM.G.markers.highlight.show();
|
OSRM.G.markers.highlight.show();
|
||||||
@ -104,7 +112,10 @@ show: function(response) {
|
|||||||
|
|
||||||
body += '<td class="description-body-items">';
|
body += '<td class="description-body-items">';
|
||||||
var pos = positions[response.route_instructions[i][3]];
|
var pos = positions[response.route_instructions[i][3]];
|
||||||
body += '<div class="description-body-item" onclick="OSRM.RoutingDescription.onClickRouteDescription('+pos.lat.toFixed(6)+","+pos.lng.toFixed(6)+')">';
|
body += '<div id="description-'+i+'" class="description-body-item" ' +
|
||||||
|
'onclick="OSRM.RoutingDescription.onClickRouteDescription('+pos.lat.toFixed(6)+","+pos.lng.toFixed(6)+')" ' +
|
||||||
|
'onmouseover="OSRM.RoutingDescription.onMouseOverRouteDescription('+pos.lat.toFixed(6)+","+pos.lng.toFixed(6)+')" ' +
|
||||||
|
'onmouseout="OSRM.RoutingDescription.onMouseOutRouteDescription('+pos.lat.toFixed(6)+","+pos.lng.toFixed(6)+')">';
|
||||||
|
|
||||||
// build route description
|
// build route description
|
||||||
if( response.route_instructions[i][1] != "" )
|
if( response.route_instructions[i][1] != "" )
|
||||||
|
Loading…
Reference in New Issue
Block a user