Fixes to touch support in Javascript

I have been using the code from the below URL to provide swipe events from javascript:

http://padilicious.com/code/touchevents/

For some reason, it has stopped working for iOS. I had to painfully fix the code which determines the swipe direction:


function determineSwipeDirection() {
    if ((swipeAngle <= 46) && (swipeAngle >= 0)) {
        swipeDirection = 'left';
        //alert(swipeAngle + "-left");
    } else if ((swipeAngle <= 360) && (swipeAngle >= 352)) {
        swipeDirection = 'left';
        //alert(swipeAngle + "-left");
    } else if ((swipeAngle >= 158) && (swipeAngle <= 213)) {
        swipeDirection = 'right';
        //alert(swipeAngle + "-right");
    } else if ((swipeAngle >= 45) && (swipeAngle <= 135)) {
        swipeDirection = 'down';
        //alert(swipeAngle + "-down");
    } else {
        swipeDirection = 'up';
        //alert(swipeAngle + "-up");
    }
}

Comments

Popular posts from this blog

Enable Visual Studio to use more than 2GB of memory

Firefox and Chrome dark mode

Dealing with the morons who built Dell 7710 and RAID