Calculates if the mouse position is near to a given element.