Skip to content

Commit 2505f86

Browse files
committed
Add OnClick
1 parent 90c274c commit 2505f86

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@inherits BECanvasComponent
22

3-
<canvas id="@Id" width="@Width" height="@Height" @ref="_canvasRef"></canvas>
3+
<canvas id="@Id" width="@Width" height="@Height" @ref="_canvasRef" @onclick="OnClick"></canvas>
Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
using Microsoft.AspNetCore.Components;
2-
using Microsoft.JSInterop;
3-
using System;
4-
5-
namespace Blazor.Extensions
6-
{
7-
public class BECanvasComponent : ComponentBase
8-
{
9-
[Parameter]
10-
protected long Height { get; set; }
11-
12-
[Parameter]
13-
protected long Width { get; set; }
14-
15-
protected readonly string Id = Guid.NewGuid().ToString();
16-
protected ElementRef _canvasRef;
17-
18-
internal ElementRef CanvasReference => this._canvasRef;
19-
20-
[Inject]
21-
internal IJSRuntime JSRuntime { get; set; }
22-
}
23-
}
1+
using Microsoft.AspNetCore.Components;
2+
using Microsoft.JSInterop;
3+
using System;
4+
5+
namespace Blazor.Extensions
6+
{
7+
public class BECanvasComponent : ComponentBase
8+
{
9+
[Parameter]
10+
protected long Height { get; set; }
11+
12+
[Parameter]
13+
protected long Width { get; set; }
14+
15+
protected readonly string Id = Guid.NewGuid().ToString();
16+
protected ElementRef _canvasRef;
17+
18+
internal ElementRef CanvasReference => this._canvasRef;
19+
20+
[Inject]
21+
internal IJSRuntime JSRuntime { get; set; }
22+
23+
[Parameter]
24+
protected Action<UIMouseEventArgs> OnClick { get; set; }
25+
}
26+
}

0 commit comments

Comments
 (0)