Fix: Update news window viewport if GUI zoom is changed.

This commit is contained in:
Peter Nelson 2022-09-06 17:44:01 +01:00 committed by PeterN
parent 57fa8690df
commit 8b989d4999

View File

@ -520,6 +520,18 @@ struct NewsWindow : Window {
} }
} }
void OnResize() override
{
if (this->viewport != nullptr) {
NWidgetViewport *nvp = this->GetWidget<NWidgetViewport>(WID_N_VIEWPORT);
nvp->UpdateViewportCoordinates(this);
if (ni->reftype1 != NR_VEHICLE) {
ScrollWindowToTile(GetReferenceTile(ni->reftype1, ni->ref1), this, true); // Re-center viewport.
}
}
}
/** /**
* Some data on this window has become invalid. * Some data on this window has become invalid.
* @param data Information about the changed data. * @param data Information about the changed data.