Shift width is now taken from panel width
authorSami Rämö <sami.ramo@ixonos.com>
Tue, 24 Aug 2010 09:26:34 +0000 (12:26 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Tue, 24 Aug 2010 09:26:34 +0000 (12:26 +0300)
src/map/mapview.cpp

index 952fb06..ccf2d54 100644 (file)
@@ -29,6 +29,7 @@
 #include "coordinates/scenecoordinate.h"
 #include "mapcommon.h"
 #include "mapscroller.h"
+#include "ui/panelcommon.h"
 
 #include "mapview.h"
 
@@ -253,7 +254,10 @@ void MapView::resizeEvent(QResizeEvent *event)
     emit viewResized(event->size());
 
     if (m_centerShiftAnimation) {
-        m_centerShiftAnimation->setEndValue(event->size().width() / 4);
+        int mapVisibleWidth = event->size().width() - PANEL_WIDTH - PANEL_BAR_WIDTH;
+        int mapViewMiddle = event->size().width() / 2;
+        int shiftFromMiddle = mapViewMiddle - (mapVisibleWidth / 2);
+        m_centerShiftAnimation->setEndValue(shiftFromMiddle);
         updateCenterShift();
     }
 }