});
function formatDistance(m) {
- const unitTemplate = "javascripts.directions.distance_";
- if (m < 1000) return I18n.t(unitTemplate + "m", { distance: Math.round(m) });
- if (m < 10000) return I18n.t(unitTemplate + "km", { distance: (m / 1000.0).toFixed(1) });
- return I18n.t(unitTemplate + "km", { distance: Math.round(m / 1000) });
+ if (m < 1000) {
+ return I18n.t("javascripts.directions.distance_m", { distance: Math.round(m) });
+ } else if (m < 10000) {
+ return I18n.t("javascripts.directions.distance_km", { distance: (m / 1000.0).toFixed(1) });
+ } else {
+ return I18n.t("javascripts.directions.distance_km", { distance: Math.round(m / 1000) });
+ }
}
function formatHeight(m) {
const [ll, direction, instruction, dist, lineseg] = step;
const row = $("<tr class='turn'/>");
- row.append("<td class='border-0'><div class='direction i" + direction + "'/></td> ");
+ if (direction) {
+ row.append("<td class='border-0'><svg width='20' height='20' class='d-block'><use href='#routing-sprite-" + direction + "' /></svg></td>");
+ } else {
+ row.append("<td class='border-0'>");
+ }
row.append("<td>" + instruction);
row.append("<td class='distance text-body-secondary text-end'>" + getDistText(dist));
}
function enableListeners() {
- $("#sidebar_content").on("click", ".btn-close", hideRoute);
+ $("#sidebar .sidebar-close-controls button").on("click", hideRoute);
$("#map").on("dragend dragover", function (e) {
e.preventDefault();
$(".search_form").show();
$(".directions_form").hide();
- $("#sidebar_content").off("click", ".btn-close", hideRoute);
+ $("#sidebar .sidebar-close-controls button").off("click", hideRoute);
$("#map").off("dragend dragover drop");
map.off("locationfound", sendstartinglocation);