# WebSDKuicontrol and WebCanvas refresh

**URL:** <https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620>\
**Category:** Web\
**Created:** [May 4, 2023, 7:35am UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620 "2023-05-04T07:35:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscar\_morotti](https://forum.xojo.com/letter_avatar_proxy/v4/letter/o/a4c791/32.png) [@oscar\_morotti](https://forum.xojo.com/u/oscar_morotti)\
**Post date:** [May 4, 2023, 7:35am UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/1 "2023-05-04T07:35:42Z")

</div>

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](https://forum.xojo.com/t/how-to-detect-mouse-down-in-web-container/75149/12) (@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](https://www.morotti.net/scambio/DrawingSurface.xojo_binary_project.zip)

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

Thank you,  
Oscar

---

<div class="post-metadata">

**Author:** ![Ricardo\_Cruz](https://forum.xojo.com/user_avatar/forum.xojo.com/ricardo_cruz/32/7852_2.png) [@Ricardo\_Cruz](https://forum.xojo.com/u/Ricardo_Cruz)\
**Post date:** [May 4, 2023, 9:47am UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/2 "2023-05-04T09:47:39Z")

</div>

It seems EraseBackground parameter in WebCanvas.Refresh is being ignored, I’ve just created this issue:  
[Issue #72650](https://tracker.xojo.com/xojoinc/xojo/-/issues/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.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Cruz](https://forum.xojo.com/user_avatar/forum.xojo.com/ricardo_cruz/32/7852_2.png) [@Ricardo\_Cruz](https://forum.xojo.com/u/Ricardo_Cruz)\
**Post date:** [May 4, 2023, 9:50am UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/3 "2023-05-04T09:50:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [May 4, 2023, 11:56am UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/4 "2023-05-04T11:56:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ricardo\_Cruz](https://forum.xojo.com/user_avatar/forum.xojo.com/ricardo_cruz/32/7852_2.png) [@Ricardo\_Cruz](https://forum.xojo.com/u/Ricardo_Cruz)\
**Post date:** [May 4, 2023, 12:53pm UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/5 "2023-05-04T12:53:45Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [May 4, 2023, 8:02pm UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/6 "2023-05-04T20:02:23Z")

</div>

a little teasing …

![demo esignature](https://forum.xojo.com/uploads/default/original/2X/5/53a48a41fadded9d6861c97eeec4e5039bf4b5c2.gif)

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [May 4, 2023, 8:04pm UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/7 "2023-05-04T20:04:49Z")

</div>

starting from

> **[GitHub - szimek/signature\_pad: HTML5 canvas based smooth signature drawing](https://github.com/szimek/signature_pad)**
>
> HTML5 canvas based smooth signature drawing. Contribute to szimek/signature\_pad development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [May 5, 2023, 6:07am UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/8 "2023-05-05T06:07:13Z")

</div>

you can get to this :

> **[e-signature.xojo-binary-project](https://www.cjoint.com/c/MEfgg03WgGp)**
>
> Le service des pièces jointes, CJoint.com est un service de partage de fichier gratuit pour partager vos documents dans vos courriels, sur les forums ou dans vos petites annonces.

---

<div class="post-metadata">

**Author:** ![oscar\_morotti](https://forum.xojo.com/letter_avatar_proxy/v4/letter/o/a4c791/32.png) [@oscar\_morotti](https://forum.xojo.com/u/oscar_morotti)\
**Post date:** [May 5, 2023, 8:47am UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/9 "2023-05-05T08:47:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [May 5, 2023, 10:15am UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/10 "2023-05-05T10:15:32Z")

</div>

“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.

---

<div class="post-metadata">

**Author:** ![oscar\_morotti](https://forum.xojo.com/letter_avatar_proxy/v4/letter/o/a4c791/32.png) [@oscar\_morotti](https://forum.xojo.com/u/oscar_morotti)\
**Post date:** [May 5, 2023, 11:18am UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/11 "2023-05-05T11:18:29Z")

</div>

Thank you again.  
Oscar

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [June 8, 2023, 4:59pm UTC](https://forum.xojo.com/t/websdkuicontrol-and-webcanvas-refresh/75620/12 "2023-06-08T16:59:13Z")

</div>

new home for this project :

> **[GitHub - JYPochez/esignature\_websdk: this is a Xojo WebSDK example based on...](https://github.com/JYPochez/esignature_websdk)**
>
> this is a Xojo WebSDK example based on szimek signature\_pad javascript library, to implement a web component to allow the user to sign a document. - GitHub - JYPochez/esignature\_websdk: this is a X...
