dont show speed below zero

pull/19657/head^2
Willem Melching 2021-01-06 11:25:37 +01:00
parent e4cf43c6fc
commit d8e864e33d
1 changed files with 1 additions and 1 deletions

View File

@ -306,7 +306,7 @@ static void ui_draw_vision_maxspeed(UIState *s) {
}
static void ui_draw_vision_speed(UIState *s) {
const float speed = s->scene.controls_state.getVEgo() * (s->is_metric ? 3.6 : 2.2369363);
const float speed = std::max(0.0, s->scene.controls_state.getVEgo() * (s->is_metric ? 3.6 : 2.2369363));
const std::string speed_str = std::to_string((int)std::nearbyint(speed));
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE);
ui_draw_text(s->vg, s->scene.viz_rect.centerX(), 240, speed_str.c_str(), 96 * 2.5, COLOR_WHITE, s->font_sans_bold);