diff --git a/BlazorCanvas/BlazorCanvas/Pages/Index.razor b/BlazorCanvas/BlazorCanvas/Pages/Index.razor index 35cc197..35bb4f4 100644 --- a/BlazorCanvas/BlazorCanvas/Pages/Index.razor +++ b/BlazorCanvas/BlazorCanvas/Pages/Index.razor @@ -6,8 +6,8 @@ @using Newtonsoft.Json.Linq @inject IJSRuntime jsRuntime -
- +
+

CanvasDrawing

@@ -17,10 +17,12 @@ BECanvasComponent myCanvas; Canvas2DContext currentCanvasContext; - async void OnClick(MouseEventArgs eventArgs) + async void OnMouseMove(MouseEventArgs eventArgs) { double mouseX = 0, mouseY = 0; + if (eventArgs.Buttons == 0) + return; if (divCanvas.Id?.Length > 0) { string data = await jsRuntime.InvokeAsync("getDivCanvasOffsets", @@ -34,11 +36,11 @@ currentCanvasContext = await myCanvas.CreateCanvas2DAsync(); - await currentCanvasContext.ClearRectAsync(0, 0, 800, 800); + //await currentCanvasContext.ClearRectAsync(0, 0, 800, 800); await currentCanvasContext.SetFillStyleAsync("Red"); - await currentCanvasContext.FillRectAsync(mouseX, mouseY, 5, 5); - await currentCanvasContext.StrokeTextAsync("ClientX: " + mouseX + - " Client Y: " + mouseY, 20, 20); + await currentCanvasContext.FillRectAsync(mouseX, mouseY, 2, 2); + //await currentCanvasContext.StrokeTextAsync("ClientX: " + mouseX + + // " Client Y: " + mouseY, 20, 20); } }