CanvasQuery icon indicating copy to clipboard operation
CanvasQuery copied to clipboard

Touchend is unreliable in multitouch

Open feiss opened this issue 10 years ago • 4 comments

Trying mobile multitouch support, I've notice this unpredictable behaviour. Sometimes touchend is called, sometimes is not, and sometimes is called in a wrong x,y. Test code below and try it on mobile.

The code in the docs (handling multitouch in render()) runs perfectly, but there's no easy way to know if a touch starts or ends.

Tested on iPad mini (ios 7.1.2) and Nexus7 (android 5.0.2). On the nexus, where the frame rate is lower, the effect is worse.

var app = playground({
  ready: function(){
    this.layer.clear('#000').strokeStyle('#f00');
  },
  touchstart: function(ev) {
      this.layer.fillStyle("#0f0").fillCircle(ev.x, ev.y, 5);
  },
  touchmove: function(ev) {
    this.layer.fillStyle("#fff").fillCircle(ev.x, ev.y, 2);
  },
  touchend: function(ev) {
      this.layer.strokeCircle(ev.x, ev.y, 20); // <------ !!!
  }
});

feiss avatar Feb 15 '15 18:02 feiss

@feiss - I've fixed it and put your test case online: http://canvasquery.com/toucherror

Could you confirm it's gone?

rezoner avatar Feb 15 '15 19:02 rezoner

fixed in iOS! :dancer: :+1: :+1:

in Android touchend is not called (no red circles)

ps: do you have a life? :P

feiss avatar Feb 15 '15 19:02 feiss

Will investigate android as soon as I find my nexus.

ps: Since I am crunching Jameson for PAX the answer is close to no :)

rezoner avatar Feb 15 '15 19:02 rezoner

Stop worrying about opened issues then! go go go! :loudspeaker: :loudspeaker:

(thanks anyway :)

feiss avatar Feb 15 '15 20:02 feiss