Fix: Use widget resize step instead of window resize step. (#12659)

Build Picker class list filter could be drawn incorrectly depending on how the window can be resized.
This commit is contained in:
Peter Nelson 2024-05-11 20:51:44 +01:00 committed by GitHub
parent d78f39a9df
commit 34da94ffc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -275,10 +275,11 @@ void PickerWindow::DrawWidget(const Rect &r, WidgetID widget) const
Rect ir = r.Shrink(WidgetDimensions::scaled.matrix);
const int selected = this->callbacks.GetSelectedClass();
const auto vscroll = this->GetScrollbar(WID_PW_CLASS_SCROLL);
const int y_step = this->GetWidget<NWidgetResizeBase>(widget)->resize_y;
auto [first, last] = vscroll->GetVisibleRangeIterators(this->classes);
for (auto it = first; it != last; ++it) {
DrawString(ir, this->callbacks.GetClassName(*it), *it == selected ? TC_WHITE : TC_BLACK);
ir.top += this->resize.step_height;
ir.top += y_step;
}
break;
}