Reputation: 824
building a html canvas page in react-native webview. everything seem fine except the canvas.addEventListener
call the call back with empty event object
var moveEvents = ["mousemove", "touchmove"]
moveEvents.forEach(function (moveEvent) {
canvas.addEventListener(moveEvent, function(e) {
console.log(e) // {}
mouse.x = e.pageX - this.offsetLeft;
mouse.y = e.pageY - this.offsetTop;
}, false);
don't know what could possible be wrong this behavior is only noticed on react-native here is the code working as expected on jsfiddle
Upvotes: 0
Views: 1111
Reputation: 1058
I have been struggling with the exact same thing. Regular events through DOM or jQuery didn't work for me, but the following did.
canvas.ontouchmove = function(e) {
//e.pageX;
//e.pageY;
};
Upvotes: 1