[openstreetmap/openstreetmap-website] Added km & miles distance selection (#1747)
Bryan Housel
notifications at github.com
Tue Feb 13 20:35:56 UTC 2018
bhousel commented on this pull request.
> @@ -137,13 +138,36 @@ OSM.Directions = function (map) {
}
});
- function formatDistance(m) {
- if (m < 1000) {
- return Math.round(m) + "m";
- } else if (m < 10000) {
- return (m / 1000.0).toFixed(1) + "km";
+ $(".directions_form .distance_units a").on("click", function() {
+ $(".directions_form .distance_units a").removeClass("selected");
+ $(this).addClass("selected");
+ distanceUnits = $(this).data("unit");
+ getRoute();
+ });
+
+ function formatDistance(m, distanceUnits = "km") {
I'd avoid the ES6 Javascript here - it won't work on IE11.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1747#pullrequestreview-96290375
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20180213/50043b7e/attachment.html>
More information about the rails-dev
mailing list