Skip to content

Commit b5c10b1

Browse files
karenzsheaTheMarex
authored andcommitted
clamp speed value to js max
1 parent 57d93fc commit b5c10b1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/engine/api/route_api.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "util/coordinate.hpp"
2121
#include "util/integer_range.hpp"
22+
#include "util/json_util.hpp"
2223

2324
#include <iterator>
2425
#include <vector>
@@ -249,7 +250,8 @@ class RouteAPI : public BaseAPI
249250
{
250251
annotation.values["speed"] = GetAnnotations(
251252
leg_geometry, [](const guidance::LegGeometry::Annotation &anno) {
252-
return std::round(anno.distance / anno.duration * 10.) / 10.;
253+
auto val = std::round(anno.distance / anno.duration * 10.) / 10.;
254+
return util::json::clamp_float(val);
253255
});
254256
}
255257

0 commit comments

Comments
 (0)