1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Fixed rendering issues when digital zoom is active

This commit is contained in:
Martin Tůma 2021-05-14 22:57:35 +02:00
parent 0f48e7c137
commit 2748849032
4 changed files with 12 additions and 0 deletions

View File

@ -196,6 +196,8 @@ void PathItem::setDigitalZoom(int zoom)
_digitalZoom = zoom; _digitalZoom = zoom;
_pen.setWidthF(_width * pow(2, -_digitalZoom)); _pen.setWidthF(_width * pow(2, -_digitalZoom));
_marker->setScale(pow(2, -_digitalZoom)); _marker->setScale(pow(2, -_digitalZoom));
for (int i = 0; i < _ticks.size(); i++)
_ticks.at(i)->setDigitalZoom(zoom);
updateShape(); updateShape();
} }

View File

@ -16,6 +16,7 @@ public:
void setPos(const QPointF &pos); void setPos(const QPointF &pos);
void setColor(const QColor &color) {_brush = QBrush(color);} void setColor(const QColor &color) {_brush = QBrush(color);}
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
int type() const {return parentItem()->type();} int type() const {return parentItem()->type();}
QString info() const {return static_cast<GraphicsItem*>(parentItem())->info();} QString info() const {return static_cast<GraphicsItem*>(parentItem())->info();}

View File

@ -69,3 +69,11 @@ void RouteItem::showWaypointLabels(bool show)
for (int i = 0; i < _waypoints.count(); i++) for (int i = 0; i < _waypoints.count(); i++)
_waypoints[i]->showLabel(show); _waypoints[i]->showLabel(show);
} }
void RouteItem::setDigitalZoom(int zoom)
{
for (int i = 0; i < _waypoints.count(); i++)
_waypoints[i]->setDigitalZoom(zoom);
PathItem::setDigitalZoom(zoom);
}

View File

@ -16,6 +16,7 @@ public:
RouteItem(const Route &route, Map *map, QGraphicsItem *parent = 0); RouteItem(const Route &route, Map *map, QGraphicsItem *parent = 0);
void setMap(Map *map); void setMap(Map *map);
void setDigitalZoom(int zoom);
void showWaypoints(bool show); void showWaypoints(bool show);
void showWaypointLabels(bool show); void showWaypointLabels(bool show);