Permalink
Browse files

Merge pull request #10 from nschum/offset

Fix re-positioning when frame origin not (0,0).
  • Loading branch information...
2 parents 477e9f1 + 395db65 commit efbd1d1834f120e2cb1334b9ccb6b2f55f7b17a3 @xyfeng committed Oct 8, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 XYPieChart/XYPieChart.m
View
@@ -211,7 +211,8 @@ - (void)setPieCenter:(CGPoint)pieCenter
- (void)setPieRadius:(CGFloat)pieRadius
{
_pieRadius = pieRadius;
- CGRect frame = CGRectMake(_pieCenter.x-pieRadius, _pieCenter.y-pieRadius, pieRadius*2, pieRadius*2);
+ CGPoint origin = _pieView.frame.origin;
+ CGRect frame = CGRectMake(origin.x+_pieCenter.x-pieRadius, origin.y+_pieCenter.y-pieRadius, pieRadius*2, pieRadius*2);
_pieCenter = CGPointMake(frame.size.width/2, frame.size.height/2);
[_pieView setFrame:frame];
[_pieView.layer setCornerRadius:_pieRadius];

0 comments on commit efbd1d1

Please sign in to comment.