mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-01 19:42:07 +08:00
cabana: fix hang on scrubbing in zommed chart (#27568)
old-commit-hash: d09a9a08fc21edc03edeb40e1080d8495a7d2915
This commit is contained in:
@@ -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();
|
||||
// Prevent seeking past the end of the route
|
||||
t = std::clamp(t, 0., can->totalSeconds());
|
||||
can->seekTo(t);
|
||||
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);
|
||||
}
|
||||
}
|
||||
emit updated();
|
||||
emit msgsReceived(&can_msgs);
|
||||
QTimer::singleShot(0, [this]() {
|
||||
emit updated();
|
||||
emit msgsReceived(&can_msgs);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user