mirror of https://github.com/OpenTTD/OpenTTD
Fix: Missing extra padding when drawing tooltip text. (#10201)
* Fix: Missing extra padding when drawing tooltip text. This padding is included when calculating the size of the tooltips, the difference caused a mismatch in height for some tooltips. * Codechange: Don't draw grey panel underneath tooltip. This removes the default framerect padding so it is now added explicitly. SetMinimalSize is also removed as this is overridden in UpdateWidgetSize anyway.pull/10203/head
parent
3100c6e7d0
commit
485368f607
|
@ -656,7 +656,7 @@ void HideFillingPercent(TextEffectID *te_id)
|
|||
}
|
||||
|
||||
static const NWidgetPart _nested_tooltips_widgets[] = {
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_TT_BACKGROUND), SetMinimalSize(200, 32), EndContainer(),
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_TT_BACKGROUND), EndContainer(),
|
||||
};
|
||||
|
||||
static WindowDesc _tool_tips_desc(
|
||||
|
@ -722,8 +722,8 @@ struct TooltipsWindow : public Window
|
|||
size->height = GetStringHeight(this->string_id, size->width);
|
||||
|
||||
/* Increase slightly to have some space around the box. */
|
||||
size->width += padding.width + WidgetDimensions::scaled.fullbevel.Horizontal();
|
||||
size->height += padding.height + WidgetDimensions::scaled.fullbevel.Vertical();
|
||||
size->width += WidgetDimensions::scaled.framerect.Horizontal() + WidgetDimensions::scaled.fullbevel.Horizontal();
|
||||
size->height += WidgetDimensions::scaled.framerect.Vertical() + WidgetDimensions::scaled.fullbevel.Vertical();
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
|
@ -735,7 +735,7 @@ struct TooltipsWindow : public Window
|
|||
for (uint arg = 0; arg < this->paramcount; arg++) {
|
||||
SetDParam(arg, this->params[arg]);
|
||||
}
|
||||
DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.framerect), this->string_id, TC_FROMSTRING, SA_CENTER);
|
||||
DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.framerect).Shrink(WidgetDimensions::scaled.fullbevel), this->string_id, TC_FROMSTRING, SA_CENTER);
|
||||
}
|
||||
|
||||
void OnMouseLoop() override
|
||||
|
|
Loading…
Reference in New Issue