profile: reformat timestamp labels

The timestamp labels may change their format on zoom from
"mm" to "mm:ss", depending on the zoom level. Since the
animation kept old labels, this meant that one can end up
with a mix of labels.

Therefore, always reformat the labels. Of course, this
means that the labels switch instantaneously from one format
to the other. This is in conflict with the whole idea of
"smooth" animation. Such a smooth animation could be realized
by adding a "format" flag to the Label structure and keeping
thus fading in/out labels if the format changes. Do we want
that?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-12-11 08:38:56 +01:00 committed by Dirk Hohndel
parent 2645fa1495
commit 3ae160857d

View file

@ -232,6 +232,12 @@ void DiveCartesianAxis::updateLabel(Label &label, double opacityEnd, double pos)
if (label.label) {
label.labelPosStart = label.label->pos();
label.labelPosEnd = labelPos(pos);
// For the time-axis, the format might change from "mm" to "mm:ss",
// or vice versa. Currently, we don't animate that, i.e. it will
// switch instantaneously.
if (position == Position::Bottom)
label.label->set(textForValue(label.value), textColor);
}
if (label.line) {
label.lineStart = label.line->line();