Fix grid view sometimes dropping last row
As an important optimization, grid views skip items that are not in view, and instead add empty space to the layout still has the right dimensions (for scrolling). Calculations were off though, leading to the last row being dropped when it had too few items to fill it completely.
This commit is contained in:
@@ -329,9 +329,9 @@ void BuildOnlyVisibleButtonsHelper::fill_layout_after_visible(uiBlock &block) co
|
||||
const int last_visible_idx = visible_items_range_.last();
|
||||
|
||||
if (last_item_idx > last_visible_idx) {
|
||||
const int remaining_rows = (cols_per_row_ > 0) ?
|
||||
(last_item_idx - last_visible_idx) / cols_per_row_ :
|
||||
0;
|
||||
const int remaining_rows = (cols_per_row_ > 0) ? ceilf((last_item_idx - last_visible_idx) /
|
||||
float(cols_per_row_)) :
|
||||
0;
|
||||
BuildOnlyVisibleButtonsHelper::add_spacer_button(block, remaining_rows);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user