From e06b5072305324d26613760b213888919a92bbf7 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 1 Dec 2017 12:46:51 +0100 Subject: [PATCH] Control growth of time axis While dragging waypoints around, don't grow the time axis according to dive duration (including deco stops) as this can explode too easly resulting in an effectively unresponsive planner. Rather grow it only (slowly) when a dive handler is moved to the right 10% of the profile. Signed-off-by: Robert C. Helling --- profile-widget/profilewidget2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index d7b159cd0..abaefb1cd 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -683,7 +683,8 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) percentageAxis->setVisible(false); percentageAxis->updateTicks(HR_AXIS); #endif - timeAxis->setMaximum(maxtime); + if (shouldCalculateMaxTime) + timeAxis->setMaximum(maxtime); int i, incr; static int increments[8] = { 10, 20, 30, 60, 5 * 60, 10 * 60, 15 * 60, 30 * 60 }; /* Time markers: at most every 10 seconds, but no more than 12 markers. @@ -1822,6 +1823,8 @@ void ProfileWidget2::recreatePlannedDive() int minutes = lrint(timeAxis->valueAt(activeHandler->pos()) / 60); if (minutes * 60 <= mintime || minutes * 60 >= maxtime) return; + if (minutes * 60 > timeAxis->maximum() * 0.9) + timeAxis->setMaximum(timeAxis->maximum() * 1.02); divedatapoint data = plannerModel->at(index); data.depth.mm = lrint(profileYAxis->valueAt(activeHandler->pos()) / M_OR_FT(1, 1)) * M_OR_FT(1, 1);