tinygesture icon indicating copy to clipboard operation
tinygesture copied to clipboard

Swipe events does not fire.

Open p6laris opened this issue 1 year ago • 1 comments

Hi I registered for all four swipe events, but surprisingly only the right one will fire. i don't if it's because of the touch pad or something else:


import TinyGesture from "https://unpkg.com/[email protected]/dist/TinyGesture.js";

function initSlider(target)
{
    const instance = new TinyGesture(target);
    console.log(instance)

    instance.on("swipeleft", async event => {
        console.log("swiped left")
    });
    
    instance.on("swiperight", async event => {
        console.log("swiped right")
    });
    
    instance.on("swipeup", async event => {
        console.log("swiped up")
    });
    
    instance.on("swipedown", async event => {
        console.log("swiped down")
    });
}

document.addEventListener("DOMContentLoaded", () => {
  document.querySelectorAll(".swipe").forEach(initSlider);
});

p6laris avatar Jun 30 '24 21:06 p6laris

I managed to make it work by setting the velocityThreshold to 0, and only 0 works. any fix for that would be great. Thanks.

  const instance = new TinyGesture(target, { 
    diagonalSwipes: true,
    velocityThreshold: 0, 
  });

p6laris avatar Jul 01 '24 23:07 p6laris