1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 14:53:21 +02:00

Remove the 1px offset workaround as it does not work properly anyway...

This commit is contained in:
Martin Tůma 2018-03-09 21:53:06 +01:00
parent 60fcff7658
commit a64e5e13c3

View File

@ -85,17 +85,6 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
void MapView::centerOn(const QPointF &pos)
{
QGraphicsView::centerOn(pos);
/* Fix the offset caused by QGraphicsView::centerOn() approximation */
QPointF center = mapToScene(viewport()->rect().center());
QPoint offset((int)(pos.x() - center.x()), (int)(pos.y() - center.y()));
if (qAbs(offset.x()) == 1)
horizontalScrollBar()->setValue(horizontalScrollBar()->value()
+ offset.x());
if (qAbs(offset.y()) == 1)
verticalScrollBar()->setValue(verticalScrollBar()->value()
+ offset.y());
QRectF vr(mapToScene(viewport()->rect()).boundingRect());
_res = _map->resolution(vr);
_mapScale->setResolution(_res);