summaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-05-17 22:22:50 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-26 15:46:41 -0700
commit53a8075bd8d7231f2bb483b9adca0fc60d4446f1 (patch)
treeca9cd8d4c1072cac8611de7f96b3cbc3184f62c9 /profile-widget
parent7b18be2a50e3c94fa1e9ae30c92bbb3eee3593d6 (diff)
downloadsubsurface-53a8075bd8d7231f2bb483b9adca0fc60d4446f1.tar.gz
Fix right boundary when moving last handle in planner
There was a bug in the old code due to confusion between minutes and seconds as the unit of the time axis. But rather than limiting the time for the last handle in terms of the time axis (which potentially includes long deco and allowing that for bottom time quickly leads to dives many many hours long) limit it to 150% of the previous bottom time. Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/profilewidget2.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 828f9eed3..4efd53fed 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -1808,7 +1808,8 @@ void ProfileWidget2::recreatePlannedDive()
DiveHandler *activeHandler = qobject_cast<DiveHandler *>(sender());
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
int index = fixHandlerIndex(activeHandler);
- int mintime = 0, maxtime = lrint((timeAxis->maximum() + 10) * 60);
+ int mintime = 0;
+ int maxtime = plannerModel->at(plannerModel->size() - 1).time * 3 / 2;
if (index > 0)
mintime = plannerModel->at(index - 1).time;
if (index < plannerModel->size() - 1)