Fix: Incorrect padding on industry cargo window.

pull/532/head
Peter Nelson 1 year ago committed by PeterN
parent 882f06bf14
commit cccf4953f7

@ -1872,7 +1872,7 @@ static const NWidgetPart _nested_industry_cargoes_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_IC_PANEL), SetResize(1, 10), SetMinimalSize(200, 90), SetScrollbar(WID_IC_SCROLLBAR), EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_IC_PANEL), SetResize(1, 10), SetScrollbar(WID_IC_SCROLLBAR), EndContainer(),
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_IC_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL),
@ -2924,17 +2924,17 @@ struct IndustryCargoesWindow : public Window {
{
if (widget != WID_IC_PANEL) return;
Rect ir = r.Shrink(WidgetDimensions::scaled.framerect);
Rect ir = r.Shrink(WidgetDimensions::scaled.bevel);
DrawPixelInfo tmp_dpi;
if (!FillDrawPixelInfo(&tmp_dpi, ir.left, ir.top, ir.Width(), ir.Height())) return;
AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi);
int left_pos = ir.left;
int left_pos = WidgetDimensions::scaled.frametext.left - WidgetDimensions::scaled.bevel.left;
if (this->ind_cargo >= NUM_INDUSTRYTYPES) left_pos += (CargoesField::industry_width + CargoesField::cargo_field_width) / 2;
int last_column = (this->ind_cargo < NUM_INDUSTRYTYPES) ? 4 : 2;
const NWidgetBase *nwp = this->GetWidget<NWidgetBase>(WID_IC_PANEL);
int vpos = -this->vscroll->GetPosition() * nwp->resize_y;
int vpos = WidgetDimensions::scaled.frametext.top - WidgetDimensions::scaled.bevel.top - this->vscroll->GetPosition() * nwp->resize_y;
for (uint i = 0; i < this->fields.size(); i++) {
int row_height = (i == 0) ? CargoesField::small_height : CargoesField::normal_height;
if (vpos + row_height >= 0) {

Loading…
Cancel
Save