From ab830fcfd78010a551db0f31d0617000a91a21cd Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Wed, 12 Jan 2022 22:07:48 +0100 Subject: [PATCH] profile: fix tankbar The logic has just been completely broken when implementing zooming. Fixes #3376 Reported-by: Anton Lundin glance@acc.umu.se Signed-off-by: Berthold Stoeger --- profile-widget/tankitem.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/profile-widget/tankitem.cpp b/profile-widget/tankitem.cpp index 92fe056ee..8715c963e 100644 --- a/profile-widget/tankitem.cpp +++ b/profile-widget/tankitem.cpp @@ -89,19 +89,18 @@ void TankItem::setData(const struct dive *d, int plotStartTime, int plotEndTime) // skip over all gas changes before the plotted range const struct event *ev = get_next_event(dc->events, "gaschange"); - while (ev && (int)ev->time.seconds <= plotStartTime) + while (ev && (int)ev->time.seconds <= plotStartTime) { + gasmix = get_gasmix_from_event(d, ev); ev = get_next_event(ev->next, "gaschange"); + } // work through all the gas changes and add the rectangle for each gas while it was used int startTime = plotStartTime; while (ev && (int)ev->time.seconds < plotEndTime) { - gasmix = get_gasmix_from_event(d, ev); createBar(startTime, ev->time.seconds, gasmix); startTime = ev->time.seconds; gasmix = get_gasmix_from_event(d, ev); ev = get_next_event(ev->next, "gaschange"); } - if (ev) - gasmix = get_gasmix_from_event(d, ev); createBar(startTime, plotEndTime, gasmix); }