added function that finds closest node from mouse click