From 53a8075bd8d7231f2bb483b9adca0fc60d4446f1 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Wed, 17 May 2017 22:22:50 +0200 Subject: 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 --- profile-widget/profilewidget2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(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) -- cgit v1.2.3-70-g09d2