Skip to content

Commit

Permalink
clamp speed value to js max
Browse files Browse the repository at this point in the history
  • Loading branch information
karenzshea authored and TheMarex committed Feb 22, 2017
1 parent 57d93fc commit b5c10b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/engine/api/route_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "util/coordinate.hpp"
#include "util/integer_range.hpp"
#include "util/json_util.hpp"

#include <iterator>
#include <vector>
Expand Down Expand Up @@ -249,7 +250,8 @@ class RouteAPI : public BaseAPI
{
annotation.values["speed"] = GetAnnotations(
leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
return std::round(anno.distance / anno.duration * 10.) / 10.;
auto val = std::round(anno.distance / anno.duration * 10.) / 10.;
return util::json::clamp_float(val);
});
}

Expand Down

0 comments on commit b5c10b1

Please sign in to comment.