Skip to content

Commit 7d467b5

Browse files
committed
remove un-needed TextScale multiplications in ToolTip
1 parent 5958093 commit 7d467b5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Assets/Scripts/Game/UserInterface/ToolTip.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ public void Draw(string text)
166166
Rect rect = Rectangle;
167167
if (rect.xMax > Screen.width)
168168
{
169-
float difference = (rect.xMax - Screen.width) * 1f / LocalScale.x * textScale;
169+
float difference = (rect.xMax - Screen.width) * 1f / LocalScale.x;
170170
Vector2 newPosition = new Vector2(Position.x - difference, Position.y);
171171
Position = newPosition;
172172
}
173173
if (rect.yMax > Screen.height)
174174
{
175-
float difference = (rect.yMax - Screen.height) * 1f / LocalScale.y * textScale;
175+
float difference = (rect.yMax - Screen.height) * 1f / LocalScale.y;
176176
Vector2 newPosition = new Vector2(Position.x, Position.y - difference);
177177
Position = newPosition;
178178
}
@@ -202,8 +202,8 @@ public override void Draw()
202202
// Determine text position
203203
Rect rect = Rectangle;
204204
Vector2 textPos = new Vector2(
205-
rect.x + LeftMargin * (LocalScale.x * textScale),
206-
rect.y + TopMargin * (LocalScale.y * textScale)
205+
rect.x + LeftMargin * LocalScale.x,
206+
rect.y + TopMargin * LocalScale.y
207207
);
208208

209209
//if (rect.xMax > Screen.width) textPos.x -= (rect.xMax - Screen.width);
@@ -257,7 +257,7 @@ void UpdateTextRows(string text)
257257
widestRow = 0;
258258
for (int i = 0; i < textRows.Length; i++)
259259
{
260-
float width = font.CalculateTextWidth(textRows[i], LocalScale * textScale);
260+
float width = font.CalculateTextWidth(textRows[i], LocalScale);
261261
if (width > widestRow)
262262
widestRow = width;
263263
}

0 commit comments

Comments
 (0)