diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-10-21 14:27:50 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-10-21 14:27:50 -0700 |
commit | f81d316570fdd06be8db2ad36c2fb21c51c2592a (patch) | |
tree | d92b8bc8dab32fadf24d5635fd8625250694ccf5 /qt-ui | |
parent | 0d30d2f064c77f4eb3420fd22dce513d42ccc9f3 (diff) | |
download | subsurface-f81d316570fdd06be8db2ad36c2fb21c51c2592a.tar.gz |
Correctly place the first gas label in drop to bottom mode
When dropping to the bottom in plan (and add) mode, the gas label was
placed along the diagonal line from (0,0) to the second dive data point
(i.e. the one at the end of the "at deptch" segment). That looks terrible,
the label needs to be along the segment that we are spending at the
bottom.
This patch fixes that problem.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 6efe08bfd..664232502 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -1349,7 +1349,6 @@ void ProfileWidget2::repositionDiveHandlers() { DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance(); // Re-position the user generated dive handlers - int last = 0; for (int i = 0; i < plannerModel->rowCount(); i++) { struct divedatapoint datapoint = plannerModel->at(i); if (datapoint.time == 0) // those are the magic entries for tanks @@ -1357,14 +1356,25 @@ void ProfileWidget2::repositionDiveHandlers() DiveHandler *h = handles.at(i); h->setVisible(datapoint.entered); h->setPos(timeAxis->posAtValue(datapoint.time), profileYAxis->posAtValue(datapoint.depth)); - QPointF p1 = (last == i) ? QPointF(timeAxis->posAtValue(0), profileYAxis->posAtValue(0)) : handles[last]->pos(); + QPointF p1; + if (i == 0) { + if (prefs.drop_stone_mode) + // place the text on the straight line from the drop to stone position + p1 = QPointF(timeAxis->posAtValue(datapoint.depth / prefs.descrate), + profileYAxis->posAtValue(datapoint.depth)); + else + // place the text on the straight line from the origin to the first position + p1 = QPointF(timeAxis->posAtValue(0), profileYAxis->posAtValue(0)); + } else { + // place the text on the line from the last position + p1 = handles[i - 1]->pos(); + } QPointF p2 = handles[i]->pos(); QLineF line(p1, p2); QPointF pos = line.pointAt(0.5); gases[i]->setPos(pos); gases[i]->setVisible(datapoint.entered); gases[i]->setText(dpGasToStr(plannerModel->at(i))); - last = i; } } |