SpaceAnalyzer: Fix TreeMapWidget layout issue for small rects.

For small rects there was a disagreement between two parts of the
layout algorithm. There is a function that decides if there is
enough space in a rectangle for a label. But this function was
called on two slightly different rectangles.
This commit is contained in:
Mart G 2021-01-14 12:37:08 +01:00 committed by Andreas Kling
parent 8e6c320af1
commit 29102051d9

View file

@ -84,7 +84,7 @@ Gfx::IntRect TreeMapWidget::inner_rect_for_frame(const Gfx::IntRect& rect) const
Gfx::IntRect tmp_rect = rect;
tmp_rect.shrink(2, 2); // border
tmp_rect.shrink(2, 2); // shading
if (rect_can_contain_label(rect)) {
if (rect_can_contain_label(tmp_rect)) {
tmp_rect.set_y(tmp_rect.y() + font().presentation_size() + margin);
tmp_rect.set_height(tmp_rect.height() - (font().presentation_size() + margin * 2));
tmp_rect.set_x(tmp_rect.x() + margin);