diff --git a/Assets/Scripts/Game/UserInterface/ToolTip.cs b/Assets/Scripts/Game/UserInterface/ToolTip.cs index e7a310162c..c955c4d265 100644 --- a/Assets/Scripts/Game/UserInterface/ToolTip.cs +++ b/Assets/Scripts/Game/UserInterface/ToolTip.cs @@ -44,10 +44,25 @@ public class ToolTip : BaseScreenComponent string lastText = string.Empty; bool previousSDFState; + float textScale = 1.0f; // scale text + #endregion #region Properties + /// + /// Set text scale factor - 1.0f is default value, 0.5f is half sized text, 2.0f double sized text and so on + /// + public float TextScale + { + get { return textScale; } + set + { + textScale = Math.Max(0.1f, value); + // Draw(); + } + } + /// /// Gets or sets font used inside tooltip. /// @@ -141,8 +156,8 @@ public void Draw(string text) // Set tooltip size Size = new Vector2( - widestRow + LeftMargin + RightMargin, - font.GlyphHeight * textRows.Length + TopMargin + BottomMargin - 1); + (widestRow + LeftMargin + RightMargin) * textScale, + (font.GlyphHeight * textScale) * textRows.Length + TopMargin + BottomMargin - 1); // Set tooltip position Position = Parent.ScaledMousePosition + MouseOffset; @@ -188,15 +203,16 @@ public override void Draw() Rect rect = Rectangle; Vector2 textPos = new Vector2( rect.x + LeftMargin * LocalScale.x, - rect.y + TopMargin * LocalScale.y); + rect.y + TopMargin * LocalScale.y + ); //if (rect.xMax > Screen.width) textPos.x -= (rect.xMax - Screen.width); // Draw tooltip text for (int i = 0; i < textRows.Length; i++) { - font.DrawText(textRows[i], textPos, LocalScale, textColor); - textPos.y += font.GlyphHeight * LocalScale.y; + font.DrawText(textRows[i], textPos, (LocalScale * textScale), textColor); + textPos.y += font.GlyphHeight * (LocalScale.y * textScale); } // Lower flag