Skip to content

Commit f11fdb0

Browse files
committedApr 1, 2015
Don`t change current visibility flag of rubberband on updates
1 parent a844bfa commit f11fdb0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
 

‎src/gui/qgsrubberband.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ void QgsRubberBand::updateRect()
567567
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + r.width()*res, topLeft.y() - r.height()*res );
568568

569569
setRect( rect );
570-
setVisible( true );
570+
setVisible( isVisible() );
571571
}
572572

573573
void QgsRubberBand::updatePosition( )

‎tests/src/gui/testqgsrubberband.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ void TestQgsRubberband::testBoundingRect()
128128
mRubberband->setIconSize( 5 ); // default, but better be explicit
129129
mRubberband->setWidth( 1 ); // default, but better be explicit
130130
mRubberband->addGeometry( geom.data(), mPolygonLayer );
131+
mRubberband->setVisible( true );
131132

132133
// 20 pixels for the extent + 3 for pen & icon per side + 2 of padding
133134
QCOMPARE( mRubberband->boundingRect(), QRectF(QPointF(-1,-1),QSizeF(28,28)) );
@@ -151,6 +152,11 @@ void TestQgsRubberband::testBoundingRect()
151152
mapSize.height() - ( 30 + 3 ) * 2
152153
) );
153154

155+
// Check visibility after zoom
156+
mRubberband->setVisible( false );
157+
mCanvas->zoomIn();
158+
QCOMPARE( mRubberband->isVisible(), false );
159+
154160
}
155161

156162

0 commit comments

Comments
 (0)