0

I have a multi-monitor setup and occasionally I can see a glitch occur whereby the second monitor goes black (after some graphical glitching) - when it comes back my canvas is empty - i.e. it needs redrawing.

Is there an event to signal that it needs redrawing?

  • You don't directly draw to the screen but to a buffer. The browser redraws the necessary parts when needed. What you describe is unrelated to the canvas needing redrawing. It's probably the element being deleted and recreated. – Denys Séguret Mar 08 '17 at 20:55
  • I understand that - is there a way for me to know that it's been recreated and I must redraw it? –  Mar 08 '17 at 21:00
  • *your* code recreated the element. And by "recreated" we mean the element has been removed and a new one has been added to the page. – Denys Séguret Mar 08 '17 at 21:02
  • No, that's never done in my code –  Mar 08 '17 at 21:05
  • In any case we can't solve your problem without some code enabling a reproduction. Please read http://stackoverflow.com/help/mcve – Denys Séguret Mar 08 '17 at 21:10
  • A simple resize of the canvas also clears it. And depending on the browser this could be as little as setting the dimensions of the canvas to the exact same values they have been. My buest guess would be that you have some script to resize the canvas relative to screensize. And for some reason the browser thinks it needs to "resize"; probably just for the fraction of a second. – Thomas Mar 08 '17 at 21:12
  • It sounds as your display driver has a bug and needs an update (or the cable?). If the driver crashes or otherwise forces the browser to rebuild the memory buffers for the canvas bitmap there is not much we can do as canvas doesn't have an external source for its content - it's in-memory only (like f.ex. images do ie. reloading from cache/url). You *can* try to listen to the window.onresize event to see if it triggers (I slightly doubt it will in this case though) and redraw from there... –  Mar 09 '17 at 20:19
  • Possible duplicate of [Why does omitting beginPath() redraw everything?](https://stackoverflow.com/questions/21869609/why-does-omitting-beginpath-redraw-everything) – Paul Sweatte Sep 13 '17 at 22:17

0 Answers0