Android : touchstart evet not fired on android

on Wednesday, April 1, 2015


I have the following code to raise a touch event on the canvas or the element in particular.


The touch event is never raised on the browser using chrome. There are no errors either. I get returned true after I dispatch the event


Could anyone tell me where is this going wrong?


It works fine on safari on iOS



x = 175;y=75;
var touch = document.createTouch(window, window, 1, x, y, x, y);
var touches = document.createTouchList(touch);
var targetTouches = document.createTouchList(touch);
var changedTouches = document.createTouchList(touch);

var event = document.createEvent("TouchEvent");
event.initTouchEvent('touchstart', true, true, window, null, x, y, x, y, false, false, false, false, touches, targetTouches, changedTouches, 1, 0);
// both the following methods fail to raise any event
renderer.view.dispatchEvent(event);
var el = document.elementFromPoint(x,y);
el.dispatchEvent(event);

0 comments:

Post a Comment