Fix ui::table in case of zero rows/columns

This commit is contained in:
Nikita Lisitsa 2022-03-14 18:00:34 +03:00
parent 8d41e7fcd9
commit 1878fe4b3b

View file

@ -14,7 +14,9 @@ namespace psemek::ui
line_y_.resize(row_count() + 1);
line_x_.resize(column_count() + 1);
for (std::size_t r = 0; r <= row_count(); ++r)
if (row_count() == 0)
line_y_[0] = box[1].center();
else for (std::size_t r = 0; r <= row_count(); ++r)
{
if (r == 0)
line_y_[r] = row_shape_[0].min - offset;
@ -25,7 +27,9 @@ namespace psemek::ui
line_y_[r] = std::round(line_y_[r]);
}
for (std::size_t c = 0; c <= column_count(); ++c)
if (column_count() == 0)
line_x_[0] = box[0].center();
else for (std::size_t c = 0; c <= column_count(); ++c)
{
if (c == 0)
line_x_[c] = column_shape_[0].min - offset;