Javascript :: How to catch mouse-up event outside of element?
<p>I have simple Javascript code, similar to this one:</p>

<pre><code>var mouseIsDown = false;
...
function canvasMouseDown(e) {
  ...
  mouseIsDown = true;
}
function canvasMouseUp(e) {
  mouseIsDown = false;
}
function canvasMouseMove(e) {
  if (mouseIsDown) {
    ...
  }
}
</code></pre>

<p>with implemention my own user interface for tranformations (translations, scalings and rotations) with canvas.</p>

<p>Such implementation within <code>canvasMouseMove()</code> function check <code>mouseIsDown</code> variable. All works fine if user does not release mouse button when the cursor/pointer is outside of the canvas element. If that happen, the variable <code>mouseIsDown</code> stays <code>true</code> and is not turned off by <code>canvasMouseUp</code> function.</p>

<p>What is easy fix or solution in pure JavaScript <em>(no jQuery)</em> for this issue?</p>
