'Detect the number of fingers used in gesture event

I want to implement a function that zoom object when user uses two fingers to scale.

I am trying to use gesturechange event to implement it, but I found the event fired as long as the fingers number exceed one. I want to stop zoom when user uses too many fingers to operate object (it is hard to get the correct position and scale ratio).

Could I detect the number of fingers when gesturechange fired? I know touchstart event has a event.touches.length can get it. But I want to know is the same property in gesturechange event.



Solution 1:[1]

Actually this is possible only on IOSX devices. Android does not expose this information to javascript. For example you have the:

document.ongesturechange=function(e)
{
    //e.scale
    //fingers=e.touches.length;
};

event, but this will work only on iphone/ipad.

Some jquery libraries like http://jgestures.codeplex.com/ can help simulate gesture events on android.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 albanx