Use motion event to detect gesture.