bradbirdsall/Swipe — Issue #24: Android 2.2 change for when event scale is undefined
Author: ColinGrant
Created: 2012-01-21 01:01:51+00:00
State: open

Great library. I use it on iPhone devices. I just ported to Android 2.2 and found a necessary change. Not sure why I had to do this.

In the onTouchMove() function there is a test to ignore pinch/zoom gestures. Specifically there is a test against the scale of the event:

> // ensure swiping with one touch and not pinching
> if(e.touches.length > 1 || e.scale !== 1) return;

On a Motorola Droid 2 running OS 2.2 the e.scale member variable is always undefined for a swipe. "undefined !== 1" and thus the onTouchMove event handler never gets past this test. In my copy of your library I added the following hack just before the test:

> if (e.scale == undefined) {
>	// Not sure what it means, but its not a pinch/zoom event
>	e.scale = 1;
> }