Skip to content

Commit

Permalink
Don`t change current visibility flag of rubberband on updates
Browse files Browse the repository at this point in the history
  • Loading branch information
naihil committed Apr 1, 2015
1 parent a844bfa commit f11fdb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/qgsrubberband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ void QgsRubberBand::updateRect()
QgsRectangle rect( topLeft.x(), topLeft.y(), topLeft.x() + r.width()*res, topLeft.y() - r.height()*res );

setRect( rect );
setVisible( true );
setVisible( isVisible() );
}

void QgsRubberBand::updatePosition( )
Expand Down
6 changes: 6 additions & 0 deletions tests/src/gui/testqgsrubberband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ void TestQgsRubberband::testBoundingRect()
mRubberband->setIconSize( 5 ); // default, but better be explicit
mRubberband->setWidth( 1 ); // default, but better be explicit
mRubberband->addGeometry( geom.data(), mPolygonLayer );
mRubberband->setVisible( true );

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

// Check visibility after zoom
mRubberband->setVisible( false );
mCanvas->zoomIn();
QCOMPARE( mRubberband->isVisible(), false );

}


Expand Down

0 comments on commit f11fdb0

Please sign in to comment.