<g visibility="@(Show ? "visible" : "hidden")">
    @for (int x = startX; x <= endX; x += 1)
    {
        <line x1="@x" y1="@originY" x2="@x" y2="@(height + originY)" />
    }
    @for (int y = startY; y <= endY; y += 1)
    {
        <line x1="@originX" y1="@y" x2="@(width + originX)" y2="@y" />
    }
</g>

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

    private double originX;
    private double originY;
    private int startX;
    private int startY;
    private int endX;
    private int endY;
    private double width;
    private double height;

    public void Resize(double mapOriginX, double mapOriginY, double mapheight, double mapwidth)
    {
        width = mapwidth;
        height = mapheight;
        originX = mapOriginX;
        originY = -height - mapOriginY;
        startX = (int)Math.Ceiling(originX);
        startY = (int)Math.Ceiling(originY);
        endX = (int)Math.Floor(width + mapOriginX);
        endY = (int)Math.Floor(-mapOriginY);
        StateHasChanged();
    }
}
