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>
This commit is contained in:
Robert C. Helling 2017-05-17 22:22:50 +02:00 committed by Dirk Hohndel
parent 7b18be2a50
commit 53a8075bd8

View file

@ -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)