X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmap%2Fmapengine.cpp;h=ca6d33e427af8d9d40aed776c5163d955240c897;hb=638875186db1376a4405bdb93d65468ac83f744b;hp=12c8e3a20e961e14d9dffaba6d8aebefbe29011e;hpb=a40fd4b4f9cd750c6a5d8459317b0d9d544b5efe;p=situare diff --git a/src/map/mapengine.cpp b/src/map/mapengine.cpp index 12c8e3a..ca6d33e 100644 --- a/src/map/mapengine.cpp +++ b/src/map/mapengine.cpp @@ -88,6 +88,9 @@ MapEngine::MapEngine(QObject *parent) this, SIGNAL(locationItemClicked(QList))); m_scroller = &MapScroller::getInstance(); + + connect(m_scroller, SIGNAL(coordinateUpdated(QPoint)), + this, SLOT(setLocation(QPoint))); } MapEngine::~MapEngine() @@ -392,10 +395,7 @@ void MapEngine::setLocation(QPoint sceneCoordinate) qDebug() << __PRETTY_FUNCTION__; // jump to opposite side of the world if world horizontal limit is exceeded - if (sceneCoordinate.x() < MAP_MIN_PIXEL_X) - sceneCoordinate.setX(sceneCoordinate.x() + MAP_PIXELS_X); - else if (sceneCoordinate.x() > MAP_MAX_PIXEL_X) - sceneCoordinate.setX(sceneCoordinate.x() - MAP_PIXELS_X); + sceneCoordinate.setX(normalize(sceneCoordinate.x(), MAP_MIN_PIXEL_X, MAP_MAX_PIXEL_X)); // don't allow vertical scene coordinates go out of the map sceneCoordinate.setY(qBound(MAP_MIN_PIXEL_Y, sceneCoordinate.y(), MAP_MAX_PIXEL_Y));