Skip to content

Commit

Permalink
Fixed neilang#37.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashfurrow committed Jun 17, 2014
1 parent 97ed5bd commit e1714a2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions NAMapKit/NAMapView.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,16 @@ - (void)centerOnPoint:(CGPoint)point animated:(BOOL)animate

- (CGPoint)zoomRelativePoint:(CGPoint)point
{
CGFloat x = (self.contentSize.width / self.originalSize.width) * point.x;
CGFloat y = (self.contentSize.height / self.originalSize.height) * point.y;
return CGPointMake(round(x), round(y));
BOOL hasContentSize = fabsf(self.originalSize.width) > 0 && fabsf(self.originalSize.height) > 0;
NSAssert(hasContentSize, @"originalSize dimension is zero, will result in NaN in returned value.");

if (hasContentSize) {
CGFloat x = (self.contentSize.width / self.originalSize.width) * point.x;
CGFloat y = (self.contentSize.height / self.originalSize.height) * point.y;
return CGPointMake(round(x), round(y));
} else {
return point;
}
}

- (void)selectAnnotation:(NAAnnotation *)annotation animated:(BOOL)animate
Expand Down

0 comments on commit e1714a2

Please sign in to comment.