Add pan gesture and fix origin bug in drawRec