Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Reloading canvas content in javascript

Post Reply
Briskitte Bardot
Posts: 6
Joined: Mon Sep 14, 2020 6:04 am

Reloading canvas content in javascript

Post 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.
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Reloading canvas content in javascript

Post by salvadordf »

Try using the DevTools methods directly. The DOMVisitor has an example to set custom attributes in the DOM.
Post Reply