Fix XData offset in ComparePane

The offset has to be the same as for basic data to keep
the sync, XData is not even warranted to start from zero.
Fixes a problem reported by Marcen at the users forum.
This commit is contained in:
Alejandro Martinez
2025-08-21 11:26:58 -03:00
parent 7f584aa02e
commit 4905655413

View File

@@ -740,23 +740,12 @@ ComparePane::dropEvent(QDropEvent *event)
// add our xdata, with not points yet...
add.data->addXData(xi.key(), x);
// manage offsets
bool first = true;
double offset = 0.0f, offsetKM = 0.0f;
foreach(XDataPoint *p, xi.value()->datapoints) {
if (p->secs > stop) break;
if (p->secs >= start) {
// intervals always start from zero when comparing
if (first) {
first = false;
offset = p->secs;
offsetKM = p->km;
}
XDataPoint *addp = new XDataPoint();
addp->km = p->km - offsetKM;
addp->secs = p->secs - offset;