rect.sideNearestToPoint(p)

Return a string ("top", "left", "right" or "bottom") denoting the side of the rectangle which is nearest to the point p.