Detect right mouse click before mouseup event

oncontextmenu is called after mouseup, so erase was getting stuck on. Now right mouse clicks are detected at time of click.
Merge pull request #6 from JamesKohli/patch-1

Detect right mouse click before mouseup event