Page 1 of 1

Reloading canvas content in javascript

Posted: Mon Sep 14, 2020 6:01 pm
by Briskitte Bardot
Hi,
There's a website where an image is displayed on a 300x200 canvas. The image itself is larger though, so I would like to see it at a better resolution. If I use the Dev Tools in the MiniBrowser demo and change the size of the canvas to 1200x800 the image is reloaded to fit the new size.
I added a button that uses Chromium1.SendProcessMessage to execute a javascript that changes the size of the canvas. The size changes, but now the canvas is empty. I would like to add some javascript code to my script that reloads the image. How do I do that?

I can trigger the reloading by after running the script do:
Splitter1.Visible := True;
Splitter1.Visible := False;

But that's not a very pretty solution. I'm sure there has to be another way, since it works when manually altering the size in Dev Tools.

Re: Reloading canvas content in javascript

Posted: Tue Sep 15, 2020 8:43 am
by salvadordf
Try using the DevTools methods directly. The DOMVisitor has an example to set custom attributes in the DOM.