From 5c4e9e7414c26c3b172c09afe27a921e3e3f91e7 Mon Sep 17 00:00:00 2001 From: Linus Wong Date: Fri, 22 Jun 2012 03:41:31 -0700 Subject: [PATCH] Fix popover right side cropping --- Classes/Popover/WEPopoverContainerView.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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"); }