mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
profile: fix displaying of gas pressures
Due to bit-rot the gas pressure and gas type were displayed on top of each other. I don't understand the meaning of the old code [log10(log10(axisRange))] (!). Therefore let's just add the height of the label to separate the labels. Probably needs some fine-tuning. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
85d1e1d199
commit
56f6e5051f
1 changed files with 5 additions and 12 deletions
|
@ -471,8 +471,7 @@ void DiveGasPressureItem::replot(const dive *d, int fromIn, int toIn, bool in_pl
|
|||
QFlags<Qt::AlignmentFlag> alignVar = Qt::AlignTop;
|
||||
std::vector<QFlags<Qt::AlignmentFlag>> align(pInfo->nr_cylinders);
|
||||
|
||||
double axisRange = (vAxis.maximum() - vAxis.minimum())/1000; // Convert axis pressure range to bar
|
||||
double axisLog = log10(log10(axisRange));
|
||||
double labelHeight = DiveTextItem::fontHeight(dpr, 1.0);
|
||||
|
||||
for (int i = from; i < to; i++) {
|
||||
const struct plot_data *entry = pInfo->entry + i;
|
||||
|
@ -484,17 +483,11 @@ void DiveGasPressureItem::replot(const dive *d, int fromIn, int toIn, bool in_pl
|
|||
continue;
|
||||
|
||||
if (!seen_cyl[cyl]) {
|
||||
double value_y_offset, label_y_offset;
|
||||
|
||||
// Magic Y offset depending on whether we're aliging
|
||||
// the top of the text or the bottom of the text to
|
||||
// the pressure line.
|
||||
value_y_offset = -0.5;
|
||||
if (alignVar & Qt::AlignTop) {
|
||||
label_y_offset = 5 * axisLog;
|
||||
} else {
|
||||
label_y_offset = -7 * axisLog;
|
||||
}
|
||||
double value_y_offset = -0.5;
|
||||
double label_y_offset = alignVar & Qt::AlignTop ? labelHeight : -labelHeight;
|
||||
plotPressureValue(mbar, entry->sec, alignVar, value_y_offset);
|
||||
plotGasValue(mbar, entry->sec, get_cylinder(d, cyl)->gasmix, alignVar, label_y_offset);
|
||||
seen_cyl[cyl] = true;
|
||||
|
|
Loading…
Reference in a new issue