Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabana: fix incorrect clamp #27218

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tools/cabana/chartswidget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down