diff --git a/CCHMapClusterController/CCHMapClusterControllerUtils.h b/CCHMapClusterController/CCHMapClusterControllerUtils.h index 9c5f14d..0369528 100644 --- a/CCHMapClusterController/CCHMapClusterControllerUtils.h +++ b/CCHMapClusterController/CCHMapClusterControllerUtils.h @@ -31,11 +31,7 @@ MKMapRect CCHMapClusterControllerAlignMapRectToCellSize(MKMapRect mapRect, double cellSize); CCHMapClusterAnnotation *CCHMapClusterControllerFindVisibleAnnotation(NSSet *annotations, NSSet *visibleAnnotations); -#if TARGET_OS_IPHONE -double CCHMapClusterControllerMapLengthForLength(MKMapView *mapView, UIView *view, double length); -#else -double CCHMapClusterControllerMapLengthForLength(MKMapView *mapView, NSView *view, double length); -#endif +double CCHMapClusterControllerMapLengthForLength(MKMapView *mapView, double length); double CCHMapClusterControllerAlignMapLengthToWorldWidth(double mapLength); BOOL CCHMapClusterControllerCoordinateEqualToCoordinate(CLLocationCoordinate2D coordinate0, CLLocationCoordinate2D coordinate1); CCHMapClusterAnnotation *CCHMapClusterControllerClusterAnnotationForAnnotation(MKMapView *mapView, id annotation, MKMapRect mapRect); diff --git a/CCHMapClusterController/CCHMapClusterControllerUtils.m b/CCHMapClusterController/CCHMapClusterControllerUtils.m index f19159f..9b39b00 100644 --- a/CCHMapClusterController/CCHMapClusterControllerUtils.m +++ b/CCHMapClusterController/CCHMapClusterControllerUtils.m @@ -59,15 +59,11 @@ MKMapRect CCHMapClusterControllerAlignMapRectToCellSize(MKMapRect mapRect, doubl return nil; } -#if TARGET_OS_IPHONE -double CCHMapClusterControllerMapLengthForLength(MKMapView *mapView, UIView *view, double length) -#else -double CCHMapClusterControllerMapLengthForLength(MKMapView *mapView, NSView *view, double length) -#endif +double CCHMapClusterControllerMapLengthForLength(MKMapView *mapView, double length) { // Convert points to coordinates - CLLocationCoordinate2D leftCoordinate = [mapView convertPoint:CGPointZero toCoordinateFromView:view]; - CLLocationCoordinate2D rightCoordinate = [mapView convertPoint:CGPointMake(length, 0) toCoordinateFromView:view]; + CLLocationCoordinate2D leftCoordinate = [mapView convertPoint:CGPointZero toCoordinateFromView:mapView]; + CLLocationCoordinate2D rightCoordinate = [mapView convertPoint:CGPointMake(length, 0) toCoordinateFromView:mapView]; // Convert coordinates to map points MKMapPoint leftMapPoint = MKMapPointForCoordinate(leftCoordinate); diff --git a/CCHMapClusterController/CCHMapClusterOperation.m b/CCHMapClusterController/CCHMapClusterOperation.m index 19a722d..9e00836 100644 --- a/CCHMapClusterController/CCHMapClusterOperation.m +++ b/CCHMapClusterController/CCHMapClusterOperation.m @@ -82,7 +82,7 @@ - (instancetype)initWithMapView:(MKMapView *)mapView cellSize:(double)cellSize m + (double)cellMapSizeForCellSize:(double)cellSize withMapView:(MKMapView *)mapView { // World size is multiple of cell size so that cells wrap around at the 180th meridian - double cellMapSize = CCHMapClusterControllerMapLengthForLength(mapView, mapView.superview, cellSize); + double cellMapSize = CCHMapClusterControllerMapLengthForLength(mapView, cellSize); cellMapSize = CCHMapClusterControllerAlignMapLengthToWorldWidth(cellMapSize); return cellMapSize;