I Can Has swipe action

I’ve had several reports that swiping no longer works in I Can Has Cheezburger 1.1. A small part of it is that when the image is zoomed, it will not let you swipe to switch images since that same gesture will reposition the enlarged image. Double-tapping to un-zoom will once again let you switch images by swiping.

The real reason is because of how I was detecting a swipe gesture.

In the original version I simply tested for a movement larger than the minimum swipe distance (which was 24 pixels).


float deltaX = fabsf(startTouchPosition.x - currentTouchPosition.x);
float deltaY = fabsf(startTouchPosition.y - currentTouchPosition.y);
// If the swipe tracks correctly.
if (deltaX >= HORIZ_SWIPE_DRAG_MIN)
.... handle swipe action

However, in version 1.1 I also check that the vertical movement is less than the minimum distance.


float deltaX = fabsf(startTouchPosition.x - currentTouchPosition.x);
float deltaY = fabsf(startTouchPosition.y - currentTouchPosition.y);
if (!zoomed && (deltaX >= HORIZ_SWIPE_DRAG_MIN) && (deltaY < = VERT_SWIPE_DRAG_MAX)) .... handle swipe action

I've reverted to the old behavior for the next update, which will support the Cheezburger submission API that isn't ready yet. I may release a small update just for this and a few other tiny fixes rather than wait for the API.

Leave a Reply