diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-01-28 21:00:47 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-01-28 21:04:50 -0800 |
commit | f5a48385192606fd6a0b68f26d3cc10b8376c576 (patch) | |
tree | c6bba1952134a36930ea1ecb6be41d8733d5cbd2 | |
parent | 279ba5823645aef97f0cf9f210cde6adfd9ae3a6 (diff) | |
download | subsurface-f5a48385192606fd6a0b68f26d3cc10b8376c576.tar.gz |
Fix dive visual editor being too quick to rescale time
When moving the last handle of a dive (in the planner, in dive add, or
when editing a dive), we rescaled the time axis whenever our idea of the
maximum duration that we should show changed. That lead to the odd
situation that you couldn't get to certain dive durations with the
visual editor (e.g. 64 minutes) because just as you approach that time
the scale changes and the dive duration jumps past the desired value.
Fixes issue #174
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | ReleaseNotes/ReleaseNotes.txt | 2 | ||||
-rw-r--r-- | profile-widget/profilewidget2.cpp | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/ReleaseNotes/ReleaseNotes.txt b/ReleaseNotes/ReleaseNotes.txt index 53ee7e329..a7fb369f9 100644 --- a/ReleaseNotes/ReleaseNotes.txt +++ b/ReleaseNotes/ReleaseNotes.txt @@ -6,6 +6,8 @@ _Subsurface_ next after 4.6 - January 2017 Some of the changes since _Subsurface_ 4.6 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +- Fix scaling issue that prevent the visual dive editor from reaching + certain dive durations - Prevent double click on dive number in dive list from (temporarily) editing dive number - Allow the user to disable tanks while planning dives (this makes it much diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index e85e41fd2..0ad2b5601 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -624,8 +624,9 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) */ plotInfo = calculate_max_limits_new(&displayed_dive, currentdc); create_plot_info_new(&displayed_dive, currentdc, &plotInfo, !shouldCalculateMaxDepth); - if (shouldCalculateMaxTime) - maxtime = get_maxtime(&plotInfo); + int newMaxtime = get_maxtime(&plotInfo); + if (shouldCalculateMaxTime || newMaxtime > maxtime) + maxtime = newMaxtime; /* Only update the max depth if it's bigger than the current ones * when we are dragging the handler to plan / add dive. @@ -856,7 +857,7 @@ void ProfileWidget2::mousePressEvent(QMouseEvent *event) if (zoomLevel) return; QGraphicsView::mousePressEvent(event); - if (currentState == PLAN) + if (currentState == PLAN || currentState == ADD || currentState == EDIT) shouldCalculateMaxTime = false; } @@ -881,7 +882,7 @@ void ProfileWidget2::mouseReleaseEvent(QMouseEvent *event) if (zoomLevel) return; QGraphicsView::mouseReleaseEvent(event); - if (currentState == PLAN) { + if (currentState == PLAN || currentState == ADD || currentState == EDIT) { shouldCalculateMaxTime = true; replot(); } |