biodiv / contactjs

Pointer gestures for your webapp
MIT License
77 stars 6 forks source link

Fire multiples tap at the same time ? #33

Closed jo-m1b closed 2 years ago

jo-m1b commented 2 years ago

I don't know if it's a bug or if I didn't understand how to do it, but how to get multiples tap at the same time like on hammer.js ?

Ex :

var PointerListener = new PointerListener(document.body);

document.querySelectorAll('.box').forEach(box => {
  box.addEventListener('tap, function(event){
      // do something
  });
});

For the moment if i "tap" on 3 boxes with 3 different fingers at the same time nothing happen !

DEBUG just say !

[PointerListener] pointerdown event detected 2 contact.nomodule.min.js:1:47954
[PointerListener] pointerup event detected contact.nomodule.min.js:1:48580
[PointerListener] hadActiveGestureDuringCurrentContact: false contact.nomodule.min.js:1:51538
[PointerListener] pointerup event detected contact.nomodule.min.js:1:48580
[PointerListener] hadActiveGestureDuringCurrentContact: false contact.nomodule.min.js:1:51538

Thanks for help !

jo-m1b commented 2 years ago

Ok, i found it i have to do like this :

document.querySelectorAll('.box').forEach(box => {
  var PointerListener = new PointerListener(box);
  box.addEventListener('tap, function(event){
      // do something
  });
});
biodiv commented 2 years ago

Thanks for bringing this up. This is a use case I did not have in mind. Currently, a SinglePointerGesture gets invalidated if two pointers are present. I am thinking about implementing a setting which allows multiple parallel SinglePointerGestures with one PointerListener.