Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>use</p> <pre><code>document.getElementById('e').addEventListener('mousemove', mov, false); document.getElementById('e').removeEventListener('mousemove', mov); </code></pre> <p>Made some fixes, but it is crazy code :)</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; window.onload = function() { window.stop = false window.canvas = document.getElementById("e"); window.context = canvas.getContext("2d"); canvas.width = document.documentElement.clientWidth; canvas.height = document.documentElement.clientHeight; } function Shift(e) { var posx = 0; var posy = 0; if (!e) var e = window.event; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; posy = e.clientY + document.body.scrollTop; + document.documentElement.scrollTop; } posx -= document.getElementById('e').offsetLeft; posy -= document.getElementById('e').offsetTop; return[posx,posy]; } function up(){ document.getElementById('e').removeEventListener('mousemove', mov); canvas.width = canvas.width; } function mov(e){ canvas.width = canvas.width; window.pos = Shift(e); context.moveTo(window.start[0],window.start[1]); context.lineTo(pos[0],pos[1]); context.stroke(); } function down(e){ window.start = Shift(e); document.getElementById('e').addEventListener('mousemove', mov, false); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;canvas id="e" onMouseDown="down()" onmousemove="" onMouseup="up()"&gt;&lt;/canvas&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    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.
    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