WebSDKuicontrol and WebCanvas refresh

I try to update webcanvas in realtime by a mousemove event.
With help of this example How to detect mouse-down in web container - #12 by Ricardo_Cruz (@Ricardo_Cruz for president) I have the position of the mouse over the webcanvas, but when I try to use the coordinates to draw a line I have a strange behavior when refreshing the webcanvas: sometimes a line appears, most of the time nothing happens.

Here a link to my project
https://www.morotti.net/scambio/DrawingSurface.xojo_binary_project.zip

Could someone help me figure out what I’m doing wrong?

Thank you,
Oscar

It seems EraseBackground parameter in WebCanvas.Refresh is being ignored, I’ve just created this issue:
Issue #72650

What you can do at the moment is storing each point in an array, then use that array to draw each line in the Paint event.

Plan B, probably faster when there are lot of lines, is to draw each line on a Picture you store server side. This way, the WebCanvas will just draw that picture, instead of sending the whole pack of lines to draw.

That may not be faster as it takes two round trips to download and draw the new picture.

But the script to render 1000s of lines in the canvas could be huge, it worth to give a try rendering the picture server side (if the other method gets slow)

a little teasing …

demo esignature

3 Likes

starting from

you can get to this :

6 Likes

Jean-Yves… you are magic! Thank you!!!

“copy as svg” button only works once, but the real svg coming from the websdk is ok
so it seems the imageviewer only accepts one svgdata ?
anyway the png output is ok too.

Thank you again.
Oscar

new home for this project :

2 Likes