diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 924877790..debc527db 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -56,6 +56,7 @@ ProfileWidget2::ProfileWidget2(DivePlannerPointsModel *plannerModelIn, double dp #endif d(nullptr), dc(0), + empty(true), #ifndef SUBSURFACE_MOBILE mouseFollowerVertical(new DiveLineItem()), mouseFollowerHorizontal(new DiveLineItem()), @@ -187,10 +188,6 @@ void ProfileWidget2::resetZoom() // Currently just one dive, but the plan is to enable All of the selected dives. void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, int flags) { - // If there was no previously displayed dive, turn off animations - if (!d) - flags |= RenderFlags::Instant; - d = dIn; dc = dcIn; if (!d) { @@ -198,6 +195,11 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, int flags) return; } + // If there was no previously displayed dive, turn off animations + if (empty) + flags |= RenderFlags::Instant; + empty = false; + QElapsedTimer measureDuration; // let's measure how long this takes us (maybe we'll turn of TTL calculation later measureDuration.start(); @@ -390,6 +392,7 @@ void ProfileWidget2::clear() profileScene->clear(); handles.clear(); gases.clear(); + empty = true; } void ProfileWidget2::setProfileState(const dive *dIn, int dcIn) diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h index fee9d5f16..c4d8b483e 100644 --- a/profile-widget/profilewidget2.h +++ b/profile-widget/profilewidget2.h @@ -146,11 +146,9 @@ private: #ifndef SUBSURFACE_MOBILE ToolTipItem *toolTipItem; #endif - // All those here should probably be merged into one structure, - // So it's esyer to replicate for more dives later. - // In the meantime, keep it here. const struct dive *d; int dc; + bool empty; // No dive shown. #ifndef SUBSURFACE_MOBILE DiveLineItem *mouseFollowerVertical; DiveLineItem *mouseFollowerHorizontal;