1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-31 02:19:09 +00:00

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:
2024-05-11 20:51:44 +01:00
committed by GitHub
parent d78f39a9df
commit 34da94ffc8

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;
}