implemented proper elasticity for pan gesture