summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-26 20:29:13 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-26 20:29:13 -0700
commit65aab8199fb24231b4d0a5e8506f6bc677e9dbb5 (patch)
tree5eae1a9107ba7778ad7266e4843923162f5053c8
parenta5e3a6fd5ec18d0bc776e57a12c73cb5df21d3ad (diff)
downloadsubsurface-65aab8199fb24231b4d0a5e8506f6bc677e9dbb5.tar.gz
Globe: change the logic to remember the current zoom value
We start out with our default. If we zoom out because of no GPS data, we remember the now current zoom value, but only if we aren't in the middle of a "flight". If we are in the middle of a flight we simply keep the last value we remembered - that means we might forget a user made change, but at least we won't suddenly remember a random number as our zoom value. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/globe.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index 2188742de..60249c852 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -36,7 +36,6 @@ GlobeGPS::GlobeGPS(QWidget *parent) : MarbleWidget(parent),
loadedDives(0),
messageWidget(new KMessageWidget(this)),
fixZoomTimer(new QTimer(this)),
- currentZoomLevel(0),
needResetZoom(false),
editingDiveLocation(false),
doubleClick(false)
@@ -46,6 +45,7 @@ GlobeGPS::GlobeGPS(QWidget *parent) : MarbleWidget(parent),
// been processed but before we initialize the rest of Marble
Marble::MarbleDebug::setEnabled(verbose);
#endif
+ currentZoomLevel = zoomFromDistance(3.0);
// check if Google Sat Maps are installed
// if not, check if they are in a known location
MapThemeManager mtm;
@@ -261,16 +261,16 @@ void GlobeGPS::centerOnDiveSite(uint32_t uuid)
// if we come back from a dive without GPS data, reset to the last zoom value
// otherwise check to make sure we aren't still running an animation and then remember
// the current zoom level
- if (!zoom()) {
- currentZoomLevel = zoomFromDistance(3);
- fixZoom();
+ if (fixZoomTimer->isActive()) {
+ fixZoomTimer->stop();
} else if (needResetZoom) {
needResetZoom = false;
fixZoom();
- } else if (!fixZoomTimer->isActive())
+ } else if (zoom() > 1000) {
currentZoomLevel = zoom();
+ }
// From the marble source code, the maximum time of
- // 'spin and fit' is 2 seconds, so wait a bit them zoom again.
+ // 'spin and fit' is 2000 miliseconds so wait a bit them zoom again.
fixZoomTimer->start(2100);
centerOn(longitude, latitude, true);