From 7c1ed27781066932a20b2331e286da2902e3a469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 10 Nov 2024 17:46:08 +0100 Subject: [PATCH] Improved area labels placement --- src/map/mapsforge/rastertile.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/map/mapsforge/rastertile.cpp b/src/map/mapsforge/rastertile.cpp index 859d0f27..a5db6b8c 100644 --- a/src/map/mapsforge/rastertile.cpp +++ b/src/map/mapsforge/rastertile.cpp @@ -197,9 +197,11 @@ void RasterTile::processAreaLabels(const QVector &paths, const QFont *font = p.ti ? &p.ti->font() : 0; const QColor *color = p.ti ? &p.ti->fillColor() : 0; const QColor *hColor = p.ti ? haloColor(p.ti) : 0; - QPointF pos = p.p->path->labelPos.isNull() - ? centroid(p.p->pp) : ll2xy(p.p->path->labelPos); + QPainterPath rp; + rp.addRect(_rect.toRectF()); + QPointF pos = p.p->path->labelPos.isNull() + ? centroid(p.p->pp & rp) : ll2xy(p.p->path->labelPos); if (p.ti && p.lbl && set.contains(*p.lbl)) continue;