2016-04-09 13 views
1

私はpinchin,pinchoutおよびpinchendを使用しています。短いpinchinまたはpinchoutの場合はpinchendが正常ですが、短いpinchinまたはpinchoutの場合はpinchendは起動しません。それはバグか何か間違っているのですか?ハンマーjs:ピンチェンドが発砲しない場合があります

gestos = new Hammer.Manager(document.body, { 
    touchAction: "manipulation" 
}); 
gestos.add(new Hammer.Pinch({event: 'pinch'})); // If it isn't added, pinchout and pinchend never fires 
gestos.add(new Hammer.Pinch({event: 'pinchin'})); 
gestos.add(new Hammer.Pinch({event: 'pinchout'})); 
gestos.add(new Hammer.Pinch({event: 'pinchend'})); 
gestos.on("pinchin pinchout pinchend", function (e) { 
    if (e.type == "pinchin") 
     interact("#mapa").resizable(false); 
    else 
     interact("#mapa").resizable(true); 
    console.log(e.type); 
}); 

答えて

0
gestos.add(new Hammer.Pinch({event: 'pinchcancel'})); 
gestos.on("pinchin pinchout pinchend pinchcencel", function (e) { 
    if (e.type == "pinchin") 
     interact("#mapa").resizable(false); 
    else 
     interact("#mapa").resizable(true); 
    console.log(e.type); 
}); 
//sometimes the device just recognize our move as pinchcancel when we actually want to fire pinchend event. 
+0

あなただけのコードスニペットを提供していない、答えを書く必要があります。 –

+0

私は私のポイントを明確にしたと思う。ちょうどpinchcancel応答イベントを追加する – Mandy

関連する問題