rect.sideNearestToPoint(p)

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