Canvas not updating when window is hidden


#1

Hi there. I am working on my very first electron app and I ran into a problem. My goal is to make a screenshot tool.

Setup
While the window is hidden, I capture the desktop, draw the image to the canvas and proceed with drawing additional handles. When finished, I set the window to show.

Problem
Unfortunately there is always a short delay between the window being shown and the canvas being updated, even though I explicitly only call the show command after everything is drawn. The issue shows itself as a short white flash or a quick flash of the old image.

Attempts

  • I saw one suggestion to disable backgroundThrottling to allow the process to run in the background. No success.
  • I have also set up a delay after the drawing is finished, just to make sure there was no async call that I was not aware. Still even after waiting full 30 seconds, the canvas still initially shows old content when showing the window.
  • I have also tried a suggestion to quickly change the document style suggested here, with no luck

Info
I am using windows 10.
Electron version is 2.0.9.
The project in question is on GitHub

Thanks everyone in advance for helping out! :grinning: