When you first start moving it's easy for the direction code to get it you. You check (line 18) that the touch has moved less in x than in y, and that means a vertical swipe. But, if x==1 and y==2, that does not mean that the swipe will be vertical, it's basically too small a change to know. You probably want to wait until the finger has moved 5% of the screen width or height before deciding what direction they are moving in. You kind of do this with you `minSwipeDist` variable, but I think you'd want to do this test before you decide there is a swipe.
↧