Warning : get your head far enough from any wall before reading :-)
You were measuring... the color of the cursor (black == '#000000'), that's why you had those strange zeros.
To see it quickly, just type return;
at the start of drawCursor()
: no more zero.
To fix it (re)draw before measuring color with getColor()
inside mouseMoveListener()
:
function mouseMoveListener(evt) {
// same code here ...
draw();
getColor();
drawCursor();
}