Skip to content

Commit

Permalink
feat: add additional precision
Browse files Browse the repository at this point in the history
  • Loading branch information
xCykrix committed Jul 18, 2024
1 parent ff1ef16 commit d102dd7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Utilities/Helpers/MapHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public static (float X, float Y) MapToWorldCoordinates(Vector2 pos, uint mapId)
float num = scale / 100f;
float x = (float)(((pos.X - 1.0) * num / 41.0 * 2048.0) - 1024.0) / num * 1000f;
float y = (float)(((pos.Y - 1.0) * num / 41.0 * 2048.0) - 1024.0) / num * 1000f;
x = (MathF.Round(x, 1, MidpointRounding.AwayFromZero) * 1000) * 0.001f / 1000f;
y = (MathF.Round(y, 1, MidpointRounding.AwayFromZero) * 1000) * 0.001f / 1000f;
x = (MathF.Round(x, 3, MidpointRounding.AwayFromZero) * 1000) * 0.001f / 1000f;
y = (MathF.Round(y, 3, MidpointRounding.AwayFromZero) * 1000) * 0.001f / 1000f;
return (x, y);
}
}
Expand Down

0 comments on commit d102dd7

Please sign in to comment.