mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Remove the 1px offset workaround as it does not work properly anyway...
This commit is contained in:
parent
60fcff7658
commit
a64e5e13c3
@ -85,17 +85,6 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
|||||||
void MapView::centerOn(const QPointF &pos)
|
void MapView::centerOn(const QPointF &pos)
|
||||||
{
|
{
|
||||||
QGraphicsView::centerOn(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());
|
QRectF vr(mapToScene(viewport()->rect()).boundingRect());
|
||||||
_res = _map->resolution(vr);
|
_res = _map->resolution(vr);
|
||||||
_mapScale->setResolution(_res);
|
_mapScale->setResolution(_res);
|
||||||
|
Loading…
Reference in New Issue
Block a user