profile: set minimum/maximum of axes with a single call

This is bike-shedding: Instead of two setMinimum()/setMaximum()
calls, use a single setBounds() call. A few axes (notably depth
and time) always have a 0 as lower bound. However, this will
change once there is a proper zooming functionality.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-09-11 21:57:49 +02:00 committed by Dirk Hohndel
parent 0bef8167d2
commit 89d9105209
4 changed files with 13 additions and 28 deletions

View file

@ -17,20 +17,11 @@ void DiveCartesianAxis::setFontLabelScale(qreal scale)
changed = true;
}
void DiveCartesianAxis::setMaximum(double maximum)
void DiveCartesianAxis::setBounds(double minimum, double maximum)
{
if (IS_FP_SAME(max, maximum))
return;
max = maximum;
changed = true;
}
void DiveCartesianAxis::setMinimum(double minimum)
{
if (IS_FP_SAME(min, minimum))
return;
changed = !IS_FP_SAME(max, maximum) || !IS_FP_SAME(min, minimum);
min = minimum;
changed = true;
max = maximum;
}
DiveCartesianAxis::DiveCartesianAxis(Position position, color_index_t gridColor, double dpr,
@ -431,7 +422,7 @@ void PartialGasPressureAxis::update(int animSpeed)
if (IS_FP_SAME(maximum(), pp))
return;
setMaximum(pp);
setBounds(0.0, pp);
setTickInterval(pp > 4 ? 0.5 : 0.25);
updateTicks(animSpeed);
}