Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed race condition with calculation for left and right coordinates … #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions CCHMapClusterController/CCHMapClusterControllerUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<MKAnnotation> annotation, MKMapRect mapRect);
Expand Down
10 changes: 3 additions & 7 deletions CCHMapClusterController/CCHMapClusterControllerUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion CCHMapClusterController/CCHMapClusterOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down