kanaka/noVNC — pull request #222 by jalfd (2013-01-22 12:21:53+00:00)
Title: Register onmouseup events if they occur outside canvas

If you press a mouse button, move the mouse outside the noVNC canvas, and then release the mouse button, no `onmouseup` event is ever seen by noVNC.

This is a minimal fix, which just always processes `onmouseup` events (figuring they're harmless if there was no prior `onmousedown` event triggered.)

To ensure the mouse is at the edge of the canvas when the `onmouseup` is triggered, I also registered a handler for the `onmouseout` event.

More complex handling could be implemented, to, for example:
- only handle `onmouseup` if one or more buttons were pressed while the mouse was on the canvas
- handle `onmousemove` as well (and clamp the coordinates to fit within the target canvas, probably)
- handle mouse wheel scrolling while outside the canvas(?)

but I'm not sure which of these behaviors would be desirable, so here's the minimal version to begin with.