mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: fix instant logic
There was logic to disable animation when switching from "no dive" to "show dive". However, that has bit-rotted away: the plotted dive was set before plotting the dive and therefore the check for "change from empty" did not work. Introduce an explicit empty flag instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e7b078a7fd
commit
f13768fe65
2 changed files with 8 additions and 7 deletions
|
@ -56,6 +56,7 @@ ProfileWidget2::ProfileWidget2(DivePlannerPointsModel *plannerModelIn, double dp
|
||||||
#endif
|
#endif
|
||||||
d(nullptr),
|
d(nullptr),
|
||||||
dc(0),
|
dc(0),
|
||||||
|
empty(true),
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
mouseFollowerVertical(new DiveLineItem()),
|
mouseFollowerVertical(new DiveLineItem()),
|
||||||
mouseFollowerHorizontal(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.
|
// 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)
|
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;
|
d = dIn;
|
||||||
dc = dcIn;
|
dc = dcIn;
|
||||||
if (!d) {
|
if (!d) {
|
||||||
|
@ -198,6 +195,11 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, int flags)
|
||||||
return;
|
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
|
QElapsedTimer measureDuration; // let's measure how long this takes us (maybe we'll turn of TTL calculation later
|
||||||
measureDuration.start();
|
measureDuration.start();
|
||||||
|
|
||||||
|
@ -390,6 +392,7 @@ void ProfileWidget2::clear()
|
||||||
profileScene->clear();
|
profileScene->clear();
|
||||||
handles.clear();
|
handles.clear();
|
||||||
gases.clear();
|
gases.clear();
|
||||||
|
empty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileWidget2::setProfileState(const dive *dIn, int dcIn)
|
void ProfileWidget2::setProfileState(const dive *dIn, int dcIn)
|
||||||
|
|
|
@ -146,11 +146,9 @@ private:
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
ToolTipItem *toolTipItem;
|
ToolTipItem *toolTipItem;
|
||||||
#endif
|
#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;
|
const struct dive *d;
|
||||||
int dc;
|
int dc;
|
||||||
|
bool empty; // No dive shown.
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
DiveLineItem *mouseFollowerVertical;
|
DiveLineItem *mouseFollowerVertical;
|
||||||
DiveLineItem *mouseFollowerHorizontal;
|
DiveLineItem *mouseFollowerHorizontal;
|
||||||
|
|
Loading…
Add table
Reference in a new issue