Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed neilang#37.
Browse files Browse the repository at this point in the history
ashfurrow committed Jun 17, 2014

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 97ed5bd commit e60544f
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
@@ -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 CGPointZero;
}
}

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

0 comments on commit e60544f

Please sign in to comment.