<path d="@data" fill="none" stroke="Green" stroke-width="0.35" stroke-opacity="1" visibility="@(Show ? PathIsNot : "hidden")" />

@code {
    [Parameter]
    public bool Show { get; set; }

    private string data = "";

    private string PathIsNot = "hidden";

    public void Clear()
    {
        data = "";
        PathIsNot = "hidden";
        StateHasChanged();
    }

    public void UpdatePath(List<NavigationPathEdge> path)
    {
        if (path.Count > 0)
        {
            var inPath = $"M {path[0].StartX} {path[0].StartY}";
            for (int i = 0; i < path.Count; i++)
            {
                if (path[i].Degree == 1) inPath = $"{inPath} L {path[i].EndX} {path[i].EndY}";
                else if (path[i].Degree == 2) inPath = $"{inPath} Q {path[i].ControlPoint1X} {path[i].ControlPoint1Y} {path[i].EndX} {path[i].EndY}";
                else inPath = $"{inPath} C {path[i].ControlPoint1X} {path[i].ControlPoint1Y}, {path[i].ControlPoint2X} {path[i].ControlPoint2Y}, {path[i].EndX} {path[i].EndY}";
            }
            data = inPath;
            PathIsNot = "visible";
        }
        else Clear();
        StateHasChanged();
    }
}
