0

I'm having trouble with the Hammer.js pinch function. The press function works wonderfully, but I'm trying to add a zoom in/zoom out function with Pinch. The app works fine without the pinch, until I add the mc.get('pinch') code. I've looked everywhere, can't find an answer. Please help :)

var myElement = document.getElementById('myCanvas');
var mc = new Hammer.Manager(myElement);

/*App does not load at all with this line of code*/
mc.get('pinch').set({ enable: true });
/****/

mc.add(new Hammer.Press({
    event: 'press',
    pointer: 1,
    threshold: 20,
    time: 10
}));
mc.add(new Hammer.Pinch({
    event: 'pinch',
    pointer: 2,
    threshold: 10,
    time: 10
}));
var diagnostics = 0;

mc.on("press", function(event)
{
    x1 = event.center.x;
    y1 = event.center.y;
});

mc.on("pinchout", function(event)
{
    //This variable is declared.
    diagnostics++;
});
mc.on("pinchin", function(event)
{
    diagnostics--;
});

1 Answers1

0

Android webview has a 300ms delay which breaks many libraries, like hammer.js. They should have a fix for this. Just in case, when doing this with a phonegap and Android, we use fastclick.js