Fix: Change duration of news window scroll depending on GUI zoom.

pull/428/head
Peter Nelson 2 years ago committed by PeterN
parent 8b989d4999
commit 2d2a5dd966

@ -267,6 +267,7 @@ struct NewsWindow : Window {
const NewsItem *ni; ///< News item to display.
static int duration; ///< Remaining time for showing the current news message (may only be access while a news item is displayed).
static const uint TIMER_INTERVAL = 210; ///< Scrolling interval, scaled by line text line height. This value chosen to maintain the 15ms at normal zoom.
GUITimer timer;
NewsWindow(WindowDesc *desc, const NewsItem *ni) : Window(desc), ni(ni)
@ -278,8 +279,6 @@ struct NewsWindow : Window {
this->flags |= WF_DISABLE_VP_SCROLL;
this->timer.SetInterval(15);
this->CreateNestedTree();
/* For company news with a face we have a separate headline in param[0] */
@ -323,6 +322,11 @@ struct NewsWindow : Window {
PositionNewsMessage(this);
}
void OnInit() override
{
this->timer.SetInterval(TIMER_INTERVAL / FONT_HEIGHT_NORMAL);
}
void DrawNewsBorder(const Rect &r) const
{
GfxFillRect(r.left, r.top, r.right, r.bottom, PC_WHITE);

Loading…
Cancel
Save