From 65aab8199fb24231b4d0a5e8506f6bc677e9dbb5 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 26 Jun 2015 20:29:13 -0700 Subject: 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 --- qt-ui/globe.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'qt-ui') 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); -- cgit v1.2.3-70-g09d2