Fixed the problem that when selecting a point close to the boundary, the wrong closest point was selected.