update reposition for prevent offscreen