From 1958d922067f5bd93683a5c89e8df4ce9f828d07 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Mon, 6 Feb 2023 06:50:32 +0800 Subject: [PATCH] cabana: fix incorrect clamp (#27218) * fix incorrect clamp * fix type error old-commit-hash: 4117986520e539aa2a6288538c940728ccb89884 --- tools/cabana/chartswidget.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cabana/chartswidget.cc b/tools/cabana/chartswidget.cc index 8591d67d51..c6f5c277eb 100644 --- a/tools/cabana/chartswidget.cc +++ b/tools/cabana/chartswidget.cc @@ -642,8 +642,8 @@ void ChartView::mouseReleaseEvent(QMouseEvent *event) { double max = chart()->mapToValue(rect.bottomRight()).x(); // Prevent zooming/seeking past the end of the route - min = std::clamp(min, can->routeStartTime(), can->routeStartTime() + can->totalSeconds()); - max = std::clamp(max, can->routeStartTime(), can->routeStartTime() + can->totalSeconds()); + min = std::clamp(min, 0., can->totalSeconds()); + max = std::clamp(max, 0., can->totalSeconds()); double min_rounded = std::floor(min * 10.0) / 10.0; double max_rounded = std::floor(max * 10.0) / 10.0;