projects
/
situare
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Self made kinetic scrolling first working version
[situare]
/
src
/
map
/
mapengine.cpp
diff --git
a/src/map/mapengine.cpp
b/src/map/mapengine.cpp
index
12c8e3a
..
ca6d33e
100644
(file)
--- a/
src/map/mapengine.cpp
+++ b/
src/map/mapengine.cpp
@@
-88,6
+88,9
@@
MapEngine::MapEngine(QObject *parent)
this, SIGNAL(locationItemClicked(QList<QString>)));
m_scroller = &MapScroller::getInstance();
this, SIGNAL(locationItemClicked(QList<QString>)));
m_scroller = &MapScroller::getInstance();
+
+ connect(m_scroller, SIGNAL(coordinateUpdated(QPoint)),
+ this, SLOT(setLocation(QPoint)));
}
MapEngine::~MapEngine()
}
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
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));
// don't allow vertical scene coordinates go out of the map
sceneCoordinate.setY(qBound(MAP_MIN_PIXEL_Y, sceneCoordinate.y(), MAP_MAX_PIXEL_Y));