*/
const int UNDEFINED = -1;
+enum ScrollDirection { SCROLL_EAST, SCROLL_WEST };
+
#endif // MAPCOMMON_H
// m_friendItemsHandler->spanFriendItems(tilesSceneRect);
- m_mapScene->spanItems();
+ m_mapScene->spanItems(m_scrollDirection);
}
void MapEngine::gpsPositionUpdate(QPointF position, qreal accuracy)
sceneCoordinate.setX(sceneCoordinate.x() - WORLD_PIXELS_X);
}
+ if (sceneCoordinate.x() > m_sceneCoordinate.x())
+ m_scrollDirection = SCROLL_EAST;
+ else
+ m_scrollDirection = SCROLL_WEST;
+
if (disableAutoCentering(sceneCoordinate))
emit mapScrolledManually();
#include <QtCore>
+#include "mapcommon.h"
+
class QGraphicsScene;
class FriendItemsHandler;
MapFetcher *m_mapFetcher; ///< Fetcher for map tiles
MapScene *m_mapScene; ///< Scene for map tiles
OwnLocationItem *m_ownLocation; ///< Item to show own location
+ ScrollDirection m_scrollDirection;
};
#endif // MAPENGINE_H
#include "mapcommon.h"
#include "mapengine.h"
+#include "maptile.h"
#include "mapscene.h"
item->moveBy(-WORLD_PIXELS_X, 0);
}
-void MapScene::spanItems()
+void MapScene::spanItems(ScrollDirection direction)
{
qDebug() << __PRETTY_FUNCTION__;
<< m_viewRect.topLeft().y() << ","
<< m_viewRect.bottomRight().x()
<< m_viewRect.bottomRight().y();
- if (m_viewRect.left() < 0) {
+ if (direction == SCROLL_WEST) {
spanRect = m_viewRect;
spanRect.setTop(0);
spanRect.setBottom(WORLD_PIXELS_Y);
#include <QGraphicsScene>
-#include "maptile.h"
+#include "mapcommon.h"
+
+class MapTile;
/**
* @brief Map scene for storing MapTile items
static void spanItem(QGraphicsItem *item, QRect tilesSceneRect);
- void spanItems();
+ void spanItems(ScrollDirection direction);
/**
* @brief Save new view rect