cabana: fix hang on scrubbing in zommed chart (#27568)

old-commit-hash: d09a9a08fc
beeps
Dean Lee 2 years ago committed by GitHub
parent d45e825c56
commit c95ca5a1d5
  1. 4
      tools/cabana/chartswidget.cc
  2. 4
      tools/cabana/streams/abstractstream.cc

@ -723,10 +723,12 @@ void ChartView::mouseReleaseEvent(QMouseEvent *event) {
void ChartView::mouseMoveEvent(QMouseEvent *ev) {
// Scrubbing
if (is_scrubbing && QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier)) {
double t = chart()->mapToValue({(double)ev->x(), (double)ev->y()}).x();
if (chart()->plotArea().contains(ev->pos())) {
double t = chart()->mapToValue(ev->pos()).x();
// Prevent seeking past the end of the route
t = std::clamp(t, 0., can->totalSeconds());
can->seekTo(t);
}
return;
}

@ -1,5 +1,5 @@
#include "tools/cabana/streams/abstractstream.h"
#include <QTimer>
#include <QtConcurrent>
AbstractStream *can = nullptr;
@ -115,6 +115,8 @@ void AbstractStream::updateLastMsgsTo(double sec) {
m.value().freq = m.value().count / std::max(1.0, m.value().ts);
}
}
QTimer::singleShot(0, [this]() {
emit updated();
emit msgsReceived(&can_msgs);
});
}

Loading…
Cancel
Save