feat: tank tree svg cards ready

This commit is contained in:
Michael Shabanov committed 2022-07-21 13:20:59 +02:00
1 parent 0d98e81a8f
commit 8c490edcc6
9 files changed
+139 -4

No files matched your search

@@ -0,0 +1,28 @@
using Microsoft.JSInterop;
using System.Threading.Tasks;
using WotBlitzStatisticsPro.Blazor.Model;
using System.Text.Json;
namespace WotBlitzStatisticsPro.Blazor.Services
{
public class SvgHelper : ISvgHelper
{
private readonly IJSRuntime _jsRuntime;
public SvgHelper(IJSRuntime jsRuntime)
{
_jsRuntime = jsRuntime;
}
public ElementDimensions CalculateTextBlockSize(string text, string fontFace, int fontSize)
{
var jsInProcess = (IJSInProcessRuntime)_jsRuntime;
return jsInProcess.Invoke<ElementDimensions>("svgHelper.CalculateTextBlockDimensions", new
{
Text = text,
Font = fontFace,
Size = fontSize
});
}
}
}