BlazorExtensions / Canvas

HTML5 Canvas API implementation for Microsoft Blazor
MIT License
602 stars 145 forks source link

Blazor-server canvas flickering #111

Open Bobetti opened 3 years ago

Bobetti commented 3 years ago

I'm trying to implement the following tutorials - https://github.com/mizrael/BlazorCanvas using blazor server side. But already on example nr.2 I see how any object is drawn on canvas is flickering.

I've made a test and created a separate solution with the same code, but instead using blazor wasm - no flickering at all.

That's the problem with blazor server?

mizrael commented 3 years ago

hi @Bobetti , is there a particular reason why you want to use Blazor Server? All the calls to the HTML Context happen on the client-side, so I can think that flickering might be due to occasional calls to the backend which inevitably slow down the app.

If you definitely need to communicate with a server, I would suggest to expose an API (possibly with a fast transport like gRPC) and call it only when really necessary. Keep also in mind that Blazor WASM is single-threaded (for now) so any call will block the rendering.

Bobetti commented 3 years ago

Thing is, I'm writing a project management software using Blazor-server. As a small part of my service, I want to implement a whiteboard functionality for the image feedback process. Images are loaded from Azure blobs and clients can draw any comments on them.

Starting doing tutorials from the above post, I noticed, that even such a simple thing as - show an image on canvas - not suitable for Blazor-server, image is flickering all the time.

Seems to me I must find some other way around...