Skip to content

Commit

Permalink
Don't highlight whole polygon in red when using map label tools
Browse files Browse the repository at this point in the history
For polygons, we don't want to fill the whole polygon itself with
the rubber band as that obscures too much of the map and prevents
users from getting a good view of the underlying map.

Instead, just use the boundary of the polygon for the rubber band.
That's enough to give a visual indicator of the feature associated
with the label without getting in the way.

(cherry picked from commit 235fee1)
  • Loading branch information
nyalldawson authored and nirvn committed Dec 18, 2019
1 parent 469a66a commit a8cd06a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/qgsmaptoollabel.cpp
Expand Up @@ -132,6 +132,14 @@ void QgsMapToolLabel::createRubberBands()
QgsGeometry geom = f.geometry();
if ( !geom.isNull() )
{
if ( geom.type() == QgsWkbTypes::PolygonGeometry )
{
// for polygons, we don't want to fill the whole polygon itself with the rubber band
// as that obscures too much of the map and prevents users from getting a good view of
// the underlying map
// instead, just use the boundary of the polygon for the rubber band
geom = QgsGeometry( geom.constGet()->boundary() );
}
QgsSettings settings;
int r = settings.value( QStringLiteral( "qgis/digitizing/line_color_red" ), 255 ).toInt();
int g = settings.value( QStringLiteral( "qgis/digitizing/line_color_green" ), 0 ).toInt();
Expand Down

0 comments on commit a8cd06a

Please sign in to comment.