$(".search").hide();
$(".routing").show();
$(".query_wrapper.routing [name=route_from]").focus();
+ $("#map").on('dragend dragover',function(e) { e.preventDefault(); });
+ $("#map").on('drop',function(e) { OSM.routing.handleDrop(e); });
});
$(".close_directions").on("click",function(e) {
$(".search").show();
$(".routing").hide();
OSM.routing.close();
+ $("#map").off('dragend drop dragover');
$(".query_wrapper.search [name=query]").focus();
});
r.requestRoute();
}
};
+
+ // Drag and drop markers
+
+ r.handleDrop=function(e) {
+ console.log(r.map.mouseEventToLatLng(e.originalEvent))
+ };
// Route-fetching UI
tr.turn:hover {
background: lighten($green, 30%);
}
+.routing_engines, #route_from, #route_to { margin-left: 25px; }
+.routing_marker { width: 15px; position: absolute; }
/* Rules for entity history */
</div>
<div class='query_wrapper routing'>
+ <%= image_tag "marker-green.png", :class => 'routing_marker', :draggable => 'true' %>
<%= text_field_tag "route_from", params[:from], :placeholder => "From", :onchange=>"OSM.routing.geocode('route_from',event)" %>
+ <%= image_tag "marker-red.png" , :class => 'routing_marker', :draggable => 'true' %>
<%= text_field_tag "route_to" , params[:to] , :placeholder => "To" , :onchange=>"OSM.routing.geocode('route_to' ,event)" %>
<select class='routing_engines' name='routing_engines' onchange="OSM.routing.selectEngine(event)"></select>
</div>