Since onmousedown
doesn't work like if you were to hold onkeydown
I have had to compromise and create my own style of it, so far I have come up with this:
can.onmousedown = function(e) {
map.moving = setInterval(function() {
console.log(e.pageX + ' ' + e.pageY);
map.posX = e.pageX;
map.posY = e.pageY;
}, 70);
}
can.onmouseup = function(e) {
clearInterval(map.moving);
}
Which works great, the only problem I'm having now, is that the e
argument is only being set upon initial click so the mouse coords stay the same for the entire interval, any idea how I can fix this?