我正在使用pinchin
,pinchout
和pinchend
。如果长pinchin
或pinchout
pinchend
可以点火,但如果它是短pinchin
或pinchout
则pinchend
不会触发。这是一个错误还是我做错了什么?
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 :(得分: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.