functionality to get the last clicked point or object