mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Adapt depth-scale to current way points
If the scale is too big or too small, adapt the scale automatically. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f9b7c5dfe9
commit
4696354f4b
1 changed files with 11 additions and 1 deletions
|
@ -484,18 +484,28 @@ void DivePlannerGraphics::drawProfile()
|
|||
plannerModel->createTemporaryPlan();
|
||||
struct diveplan diveplan = plannerModel->getDiveplan();
|
||||
struct divedatapoint *dp = diveplan.dp;
|
||||
unsigned int max_depth = 0;
|
||||
|
||||
if (!dp) {
|
||||
plannerModel->deleteTemporaryPlan();
|
||||
return;
|
||||
}
|
||||
while(dp->next)
|
||||
while(dp->next) {
|
||||
if (dp->depth > max_depth)
|
||||
max_depth = dp->depth;
|
||||
dp = dp->next;
|
||||
}
|
||||
|
||||
if (!activeDraggedHandler && (timeLine->maximum() < dp->time / 60.0 + 5 || dp->time / 60.0 + 15 < timeLine->maximum())) {
|
||||
double newMax = fmax(dp->time / 60.0 + 5, minMinutes);
|
||||
timeLine->setMaximum(newMax);
|
||||
timeLine->updateTicks();
|
||||
}
|
||||
if (!activeDraggedHandler && (depthLine->maximum() < max_depth + M_OR_FT(10,30) || max_depth + M_OR_FT(10,30) < depthLine->maximum())) {
|
||||
double newMax = fmax(max_depth + M_OR_FT(10,30), M_OR_FT(40,120));
|
||||
depthLine->setMaximum(newMax);
|
||||
depthLine->updateTicks();
|
||||
}
|
||||
|
||||
// Re-position the user generated dive handlers
|
||||
int last = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue