A small refactoring of the swiping code
The new code for horizontal swiping only triggers when the direction is set to horizontal
Or else, the code behaves as it used to