diff --git a/BlazorCanvas/BlazorCanvas/Pages/Index.razor b/BlazorCanvas/BlazorCanvas/Pages/Index.razor index 35bb4f4..d1aeb09 100644 --- a/BlazorCanvas/BlazorCanvas/Pages/Index.razor +++ b/BlazorCanvas/BlazorCanvas/Pages/Index.razor @@ -2,12 +2,26 @@ @using Blazor.Extensions @using Blazor.Extensions.Canvas @using Blazor.Extensions.Canvas.Canvas2D +@using Blazor.Extensions.Canvas.WebGL @using Newtonsoft.Json @using Newtonsoft.Json.Linq @inject IJSRuntime jsRuntime +
+ + + @* + + + *@ +
- +

CanvasDrawing

@@ -17,6 +31,8 @@ BECanvasComponent myCanvas; Canvas2DContext currentCanvasContext; + private string currentcolor { get; set; }// = "Black"; + async void OnMouseMove(MouseEventArgs eventArgs) { double mouseX = 0, mouseY = 0; @@ -37,8 +53,8 @@ currentCanvasContext = await myCanvas.CreateCanvas2DAsync(); //await currentCanvasContext.ClearRectAsync(0, 0, 800, 800); - await currentCanvasContext.SetFillStyleAsync("Red"); - await currentCanvasContext.FillRectAsync(mouseX, mouseY, 2, 2); + await currentCanvasContext.SetFillStyleAsync(currentcolor); + await currentCanvasContext.FillRectAsync(mouseX, mouseY, 1, 1); //await currentCanvasContext.StrokeTextAsync("ClientX: " + mouseX + // " Client Y: " + mouseY, 20, 20);