The PinchRecognizer
checks the number of pointers to be exactly what you specified. (This is actually checked in the superclass AttrRecognizer
) So it's actually surprising that you detect 3 pointers when not specifying the pointers parameter, since the default is 2.
Anyway, I see two solutions. One is to write your own Pinch recognizer. Just look in the hammer.js source code and modify the existing one, it's actually less than a screen long. The attrTest
function is what you're looking for. Don't call the super method (which checks the number of pointers), just check that the number of pointers is less than or equal to what you want.
A simpler solution is to define a PinchRecognizer for each number of pointers you want. So if you want to detect 4 fingers or less, do it like this:
var mc = new Hammer.Manager(element);
mc.add(new Hammer.Pinch({ event: 'pinch2', pointers: 2, threshold: 0 }));
mc.add(new Hammer.Pinch({ event: 'pinch3', pointers: 3, threshold: 0 }));
mc.add(new Hammer.Pinch({ event: 'pinch4', pointers: 4, threshold: 0 }));
Disclaimer: I haven't tested this. You might have to call recognizeWith
to link all the recognizers together.