optimize the gesture handle