function for moving lines and regions