From 8b989d49996f663b1d788bb8abf10c77b9a83080 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 6 Sep 2022 17:44:01 +0100 Subject: [PATCH] Fix: Update news window viewport if GUI zoom is changed. --- src/news_gui.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/news_gui.cpp b/src/news_gui.cpp index ee0e17fac0..03811a9abe 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -520,6 +520,18 @@ struct NewsWindow : Window { } } + void OnResize() override + { + if (this->viewport != nullptr) { + NWidgetViewport *nvp = this->GetWidget(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. * @param data Information about the changed data.