diff --git a/Classes/Popover/WEPopoverContainerView.m b/Classes/Popover/WEPopoverContainerView.m index d669d01..5a73b6e 100755 --- a/Classes/Popover/WEPopoverContainerView.m +++ b/Classes/Popover/WEPopoverContainerView.m @@ -189,7 +189,7 @@ - (void)determineGeometryForSize:(CGSize)theContentSize anchorRect:(CGRect)ancho } // If still going past right, resize width if (theOffset.x + theSize.width > CGRectGetMaxX(displayArea)) { - shift = CGRectGetMaxX(displayArea) - (theOffset.x + theSize.width); + shift = theOffset.x + theSize.width - CGRectGetMaxX(displayArea); theSize.width -= shift; } // If going past the bottom bounds, resize height @@ -235,9 +235,10 @@ - (void)determineGeometryForSize:(CGSize)theContentSize anchorRect:(CGRect)ancho xArrowOffset -= shift; theOffset.x += shift; } + // If still going past right, resize width if (theOffset.x + theSize.width > CGRectGetMaxX(displayArea)) { - shift = CGRectGetMaxX(displayArea) - (theOffset.x + theSize.width); + shift = theOffset.x + theSize.width - CGRectGetMaxX(displayArea); theSize.width -= shift; } // If going past the top bounds, resize height and shift offset @@ -390,7 +391,7 @@ - (void)determineGeometryForSize:(CGSize)theContentSize anchorRect:(CGRect)ancho arrowImage = rightArrowImage; break; } - + NSAssert(!CGRectEqualToRect(bgRect, CGRectNull), @"bgRect is null"); }