changed onpan function signature as it is called by x and y co-ordinates seperatly, not with object