Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Can you post more code than the two lines you've provided? I believe it's something more than where you've set the width/height.</p> <p>I have a drawing application that I've been tinkering with on and off for a while in which I do very much the same thing. The only difference is that I call <code>context.scale(0,0);</code> before setting the width and height. I have no issues in any version of Google Chrome with a blue overlay. Are you possibly modifying the context's scale value before setting the width and height?</p> <p>e.g. here's what I have, setting the canvas to document width/height for a full-document drawing area:</p> <pre><code>context.scale(0,0); context.canvas.width = $(document).width(); context.canvas.height = $(document).height(); </code></pre> <p>edit: my tinkering site mentioned is at <a href="http://drawcomix.com" rel="nofollow">http://drawcomix.com</a> if you want to test the blue overlay to see if it's your browser or your code.</p> <p><strong>edit:</strong> based on your additional comment...</p> <p>I've seen tutorials on the web that suggest the best way to clear the canvas is to set the height/width. That's not entirely true. On document load, it may be the quickest/easiest way to do so, but on mouse movements, you're probably better off doing something like this:</p> <pre><code>context.save(); context.setTransform(1,0,0,1,0,0); context.clearRect(0,0,width,height); // width/height of canvas context.restore(); </code></pre> <p>You may not need <code>setTransform</code> if you're not performing any transformations on the canvas.</p> <p>I believe I found this solution in Pro HTML5 Programming (Apress), but I'm not sure.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload