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 ce53cc5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Next

* [#37](https://github.com/neilang/NAMapKit/issues/37) - Fix `NAMapView` from returning `{NaN, NaN}` - [@ashfurrow](http://github.com/ashfurrow).

#### [3.1.1](https://github.com/neilang/NAMapKit/tree/v3.1.1) (5/12/2014)

* [#31](https://github.com/neilang/NAMapKit/issues/31) - Fix: `NAPinAnnotation` and `NAPinAnnotationView` retain cycle - [@dblock](https://github.com/dblock).
Expand Down
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 CGPointZero;
}
}

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

0 comments on commit ce53cc5

Please sign in to comment.