Open erikthysell opened 4 years ago
I agree! Would be nice, if this library supports the toDataUrl
functionality out of the box. The workaround I am currently using goes like this:
index.html
<script>CanvasDataUrl = (canvas, dataType) => { return canvas.toDataURL(dataType); }</script>
MyCanvas.razor.cs
[Inject]
public IJSRuntime JSRuntime { get; set; }
protected BECanvasComponent _beRef;
string myCanvasDataUrl = "";
public async Task StoreCanvasImage()
{
this.myCanvasDataUrl = await this.JSRuntime.InvokeAsync<string>("CanvasDataUrl", this._beRef.CanvasReference, "image/jpeg");
}
Using canvas with an image that refreshes very often (showing simulation real time) I am using a library that requires an url to the image. Therefore I would love a
canvas.toDataURL()
function.Leaflet.ImageOverlay.Rotated.js ->