canvas: improve computation of Table bounding box

This commit is contained in:
Paul Davis 2021-09-14 21:39:24 -06:00
parent 0878894c59
commit 6aaba192a0
2 changed files with 8 additions and 12 deletions

View file

@ -98,7 +98,7 @@ public:
Index lower_right; Index lower_right;
Duple natural_size; Duple natural_size;
Duple allocate_size; Duple allocate_size;
Duple full_size; Rect full_size;
FourDimensions padding; FourDimensions padding;
CellInfo (Item* i, PackOptions ro, PackOptions co, Index const & ul, Index const & lr, FourDimensions const & p) CellInfo (Item* i, PackOptions ro, PackOptions co, Index const & ul, Index const & lr, FourDimensions const & p)

View file

@ -85,17 +85,12 @@ Table::compute_bounding_box() const
return; return;
} }
add_child_bounding_boxes (!collapse_on_hide); for (auto const & cell : cells) {
if (_bounding_box) {
if (_bounding_box) { _bounding_box = _bounding_box.extend (cell.second.full_size);
#if 0 } else {
Rect r = _bounding_box; _bounding_box = cell.second.full_size;
}
_bounding_box = r.expand (top_padding + outline_width() + top_margin,
right_padding + outline_width() + right_margin,
bottom_padding + outline_width() + bottom_margin,
left_padding + outline_width() + left_margin);
#endif
} }
DEBUG_TRACE (DEBUG::CanvasTable, string_compose ("bounding box computed as %1\n", _bounding_box)); DEBUG_TRACE (DEBUG::CanvasTable, string_compose ("bounding box computed as %1\n", _bounding_box));
@ -441,6 +436,7 @@ Table::compute (Rect const & within)
rect)); rect));
ci->second.content->size_allocate (rect); ci->second.content->size_allocate (rect);
ci->second.full_size = rect;
hdistance += rect.width() + ci->second.padding.right; hdistance += rect.width() + ci->second.padding.right;
hdistance += col_info[c].spacing; hdistance += col_info[c].spacing;