Looks amazing, but not working for pinch on an iPad

Jul 28, 2011 at 3:35 AM
Edited Jul 28, 2011 at 3:40 AM

I've included the latest jgestures in my application and then added the following event handler:

this.container.bind("pinch", function(event, obj) {

Unfortunately, when I pinch on the container element using my 1st generation iPad, I receive this error in Mobile Safari's debug log:

Javascript Error on Line 1044
TypeError: Result of expression '_oDatajQueryGestures.oStartTouch' [undefined] is not an object.

I've done some digging, and it looks like if I add the following snippet at line 1035 I can get past the error:

_oDatajQueryGestures.oStartTouch = _oDatajQueryGestures.oStartTouch || {};

Unfortunately (as you'd expect) this provides a pinch object with no useful information. For instance, the timestamp is null and all delta information is 0's.

Though I don't understand the code, it looks like the container element is not getting the 'ojQueryGestures' data set as it should. How or when it should get set I don't know, but it looks like it should be similar to something that's in the onTouchstart() function.

Any help would be much appreciated. This library looks like the best out there, hands down.

Jul 28, 2011 at 4:34 AM

I was also able to get around this by adding the following snippet at 419. This prevented the error, but still there are no deltas.

_$element.get(0).addEventListener('touchstart', _onTouchstart, false);

I'm I reading the code right in _onGesturechange() -- does it not even compute any deltas or new screenX's / screenY's for subsequent pinch events?

Jul 28, 2011 at 5:51 PM

Pinch is fully implemented in 0.85  :)