Skip to content

Commit

Permalink
#11334 Fix cvf::Viewport assert triggered for small contour map/2d in…
Browse files Browse the repository at this point in the history
…tersection

Size of the overlay is could become negative, and would overflow for small views.

Fixes #11334.
  • Loading branch information
kriben committed Apr 8, 2024
1 parent df0a86f commit 3f3b5a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ApplicationLibCode/UserInterface/RiuViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ void RiuViewer::updateLegendLayout()
{
int legendWidth = prefSize.x();
legend->setLayoutFixedPosition( cvf::Vec2i( xPos, yPos ) );
legend->setRenderSize( cvf::Vec2ui( legendWidth, viewPortHeight - 2 * border - 2 * edgeAxisBorderHeight ) );
legend->setRenderSize( cvf::Vec2ui( legendWidth, std::max( 0, viewPortHeight - 2 * border - 2 * edgeAxisBorderHeight ) ) );
xPos += legendWidth + border;
}
else
Expand Down Expand Up @@ -858,7 +858,7 @@ void RiuViewer::updateLegendLayout()
{
int legendWidth = prefSize.x();
legend->setLayoutFixedPosition( cvf::Vec2i( xPos - legendWidth, yPos ) );
legend->setRenderSize( cvf::Vec2ui( legendWidth, viewPortHeight - yPosStart - border - edgeAxisBorderHeight ) );
legend->setRenderSize( cvf::Vec2ui( legendWidth, std::max( 0, viewPortHeight - yPosStart - border - edgeAxisBorderHeight ) ) );
xPos -= legendWidth + border;
}
else
Expand Down

0 comments on commit 3f3b5a6

Please sign in to comment.