1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Fixed broken coordinates info display under digital zoom

This commit is contained in:
Martin Tůma 2019-04-02 22:40:46 +02:00
parent c364121288
commit d70c4fefd5
3 changed files with 11 additions and 0 deletions

View File

@ -11,6 +11,8 @@ CoordinatesItem::CoordinatesItem(QGraphicsItem *parent) : QGraphicsItem(parent)
_font.setPixelSize(FONT_SIZE); _font.setPixelSize(FONT_SIZE);
_font.setFamily(FONT_FAMILY); _font.setFamily(FONT_FAMILY);
_digitalZoom = 0;
updateBoundingRect(); updateBoundingRect();
} }
@ -48,6 +50,12 @@ void CoordinatesItem::setFormat(const CoordinatesFormat &format)
updateBoundingRect(); updateBoundingRect();
} }
void CoordinatesItem::setDigitalZoom(qreal zoom)
{
_digitalZoom = zoom;
setScale(pow(2, -_digitalZoom));
}
void CoordinatesItem::updateBoundingRect() void CoordinatesItem::updateBoundingRect()
{ {
QFontMetrics fm(_font); QFontMetrics fm(_font);

View File

@ -17,6 +17,7 @@ public:
void setCoordinates(const Coordinates &c); void setCoordinates(const Coordinates &c);
void setFormat(const CoordinatesFormat &format); void setFormat(const CoordinatesFormat &format);
void setDigitalZoom(qreal zoom);
private: private:
void updateBoundingRect(); void updateBoundingRect();
@ -25,6 +26,7 @@ private:
CoordinatesFormat _format; CoordinatesFormat _format;
QRectF _boundingRect; QRectF _boundingRect;
QFont _font; QFont _font;
qreal _digitalZoom;
}; };
#endif // COORDINATESITEM_H #endif // COORDINATESITEM_H

View File

@ -476,6 +476,7 @@ void MapView::digitalZoom(int zoom)
it.value()->setDigitalZoom(_digitalZoom); it.value()->setDigitalZoom(_digitalZoom);
_mapScale->setDigitalZoom(_digitalZoom); _mapScale->setDigitalZoom(_digitalZoom);
_coordinates->setDigitalZoom(_digitalZoom);
} }
void MapView::zoom(int zoom, const QPoint &pos) void MapView::zoom(int zoom, const QPoint &pos)