fix changing direction after swipe, generalize display flip