subsurface/qt-ui/globe.h
Dirk Hohndel 8f623c2c72 Fix marble losting track of zoom level
Marble had a bug on the way it treats zoom level, there's
no way for it to find out if it's user-input or algorithm input
and when a user clicks on a dive, it spins and centers on it,
but if the user clicks on another dive when it's still spinning,
it will get the zoom in the actual state ( spinning, usually zoom
is far away from the first position ) and continue the spin to the
other position.

This patch works by saving the first location and triggering a
helper function with a timer that will only update the zoom level
if the timer is not active ( and thus, will not get the bugged
zoom state set by the animation. ).

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-10-17 15:00:22 -07:00

40 lines
898 B
C++

#ifndef GLOBE_H
#define GLOBE_H
#include <marble/MarbleWidget.h>
#include <marble/GeoDataCoordinates.h>
#include <marble/GeoDataDocument.h>
#include <QHash>
class KMessageWidget;
using namespace Marble;
struct dive;
class GlobeGPS : public MarbleWidget{
Q_OBJECT
public:
using MarbleWidget::centerOn;
GlobeGPS(QWidget *parent);
void reload();
void centerOn(struct dive* dive);
protected:
/* reimp */ void resizeEvent(QResizeEvent *event);
/* reimp */ void mousePressEvent(QMouseEvent* event);
private:
void prepareForGetDiveCoordinates(struct dive* dive);
GeoDataDocument *loadedDives;
struct dive* editingDiveCoords;
KMessageWidget* messageWidget;
QTimer *fixZoomTimer;
int currentZoomLevel;
public slots:
void changeDiveGeoPosition(qreal lon,qreal lat,GeoDataCoordinates::Unit);
void mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit);
void fixZoom();
};
#endif