mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Fixed broken coordinates info display under digital zoom
This commit is contained in:
parent
c364121288
commit
d70c4fefd5
@ -11,6 +11,8 @@ CoordinatesItem::CoordinatesItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||
_font.setPixelSize(FONT_SIZE);
|
||||
_font.setFamily(FONT_FAMILY);
|
||||
|
||||
_digitalZoom = 0;
|
||||
|
||||
updateBoundingRect();
|
||||
}
|
||||
|
||||
@ -48,6 +50,12 @@ void CoordinatesItem::setFormat(const CoordinatesFormat &format)
|
||||
updateBoundingRect();
|
||||
}
|
||||
|
||||
void CoordinatesItem::setDigitalZoom(qreal zoom)
|
||||
{
|
||||
_digitalZoom = zoom;
|
||||
setScale(pow(2, -_digitalZoom));
|
||||
}
|
||||
|
||||
void CoordinatesItem::updateBoundingRect()
|
||||
{
|
||||
QFontMetrics fm(_font);
|
||||
|
@ -17,6 +17,7 @@ public:
|
||||
|
||||
void setCoordinates(const Coordinates &c);
|
||||
void setFormat(const CoordinatesFormat &format);
|
||||
void setDigitalZoom(qreal zoom);
|
||||
|
||||
private:
|
||||
void updateBoundingRect();
|
||||
@ -25,6 +26,7 @@ private:
|
||||
CoordinatesFormat _format;
|
||||
QRectF _boundingRect;
|
||||
QFont _font;
|
||||
qreal _digitalZoom;
|
||||
};
|
||||
|
||||
#endif // COORDINATESITEM_H
|
||||
|
@ -476,6 +476,7 @@ void MapView::digitalZoom(int zoom)
|
||||
it.value()->setDigitalZoom(_digitalZoom);
|
||||
|
||||
_mapScale->setDigitalZoom(_digitalZoom);
|
||||
_coordinates->setDigitalZoom(_digitalZoom);
|
||||
}
|
||||
|
||||
void MapView::zoom(int zoom, const QPoint &pos)
|
||||
|
Loading…
Reference in New Issue
Block a user