hammerjs / hammerjs.github.io

Website
https://hammerjs.github.io
71 stars 578 forks source link

Inconsistent event values for isFirst, isFinal, and eventType #38

Open lowjam opened 8 years ago

lowjam commented 8 years ago

I am seeing events fired consistently but do not see isFirst set consistently on Pan and Pinch events. On Pan events, isFinal is set to true consistently, but on Pinch events isFinal is not set correctly.

It looks like eventType consistently returns a 4 a the end of an event, but does not consistently return a value of 1 when pan and pinch events start.

Other details:

Here is my setup code:

var tlFrame = this.$.tlFrame;
var mc = new Hammer(tlFrame);
mc.on("pan", function(e) {
  _self.handleTrack(e);
});

mc.get('pinch').set({ enable: true });
mc.on('pinch', function(e) {
  _self.pinchScale = e.scale;

  if (e.eventType === 1) _self.consoleLog('[PINCH] Start');
  if (e.eventType === 4) _self.consoleLog('[PINCH] End');
});

When I do 4 pinch actions on my laptop touchscreen, this is the console output I see:

image