Avoid unnecessary scroll bar resets in refit window

When vehicle consist is changed
This commit is contained in:
Jonathan G Rennison
2023-05-20 00:11:37 +01:00
parent d3eb7242ea
commit 7cad92988f

View File

@@ -810,6 +810,7 @@ struct RefitWindow : public Window {
{
uint scroll_row = 0;
uint row = 0;
uint old_row = this->vscroll->GetCount();
for (uint i = 0; i < NUM_CARGO; i++) {
for (uint j = 0; j < this->list[i].size(); j++) {
@@ -825,7 +826,7 @@ struct RefitWindow : public Window {
}
this->vscroll->SetCount(row);
if (scroll_row < row) this->vscroll->ScrollTowards(scroll_row);
if (scroll_row < row && row != old_row) this->vscroll->ScrollTowards(scroll_row);
}
/**