簡體   English   中英

錘子js:pinchend有時不會開火

[英]Hammer js: pinchend sometimes doesn't fire

我使用pinchinpinchoutpinchend 如果這是一個漫長pinchinpinchoutpinchend火災確定,但如果它是一個短pinchinpinchoutpinchend不火。 這是一個錯誤還是我做錯了什么?

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);
});
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.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM