diff options
author | Robert C. Helling <helling@atdotde.de> | 2017-12-01 12:46:51 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-12-01 15:47:51 -0800 |
commit | e06b5072305324d26613760b213888919a92bbf7 (patch) | |
tree | 0a784aa12ac2ac53a78cf11e57adc34ff7f1cb6b /profile-widget/profilewidget2.cpp | |
parent | 1985bcb29ecb80e7b06a664e4a29f2b9d0395737 (diff) | |
download | subsurface-e06b5072305324d26613760b213888919a92bbf7.tar.gz |
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 <helling@atdotde.de>
Diffstat (limited to 'profile-widget/profilewidget2.cpp')
-rw-r--r-- | profile-widget/profilewidget2.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
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); |