Skip to content

Commit

Permalink
fixes Outdooractive#99: recognize annotation gestures on user locatio…
Browse files Browse the repository at this point in the history
…n dot, too
  • Loading branch information
incanus committed Aug 20, 2012
1 parent 75bce17 commit 2bf35fb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
14 changes: 12 additions & 2 deletions MapView/Map/RMMapOverlayView.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,21 @@ - (CALayer *)overlayHitTest:(CGPoint)point
if ([annotation.annotationType isEqualToString:kRMTrackingHaloAnnotationTypeName])
_trackingHaloAnnotation = annotation;

_userLocationAnnotation.layer.hidden = _accuracyCircleAnnotation.layer.hidden = _trackingHaloAnnotation.layer.hidden = YES;
// here we hide the accuracy circle & tracking halo to exclude from hit
// testing, as well as be sure to show the user location (even if in
// heading mode) to ensure hits on it
//
BOOL flag = _userLocationAnnotation.layer.isHidden;

_userLocationAnnotation.layer.hidden = NO;

_accuracyCircleAnnotation.layer.hidden = _trackingHaloAnnotation.layer.hidden = YES;

CALayer *hit = [self.layer hitTest:point];

_userLocationAnnotation.layer.hidden = _accuracyCircleAnnotation.layer.hidden = _trackingHaloAnnotation.layer.hidden = NO;
_userLocationAnnotation.layer.hidden = flag;

_accuracyCircleAnnotation.layer.hidden = _trackingHaloAnnotation.layer.hidden = NO;

return hit;
}
Expand Down
10 changes: 4 additions & 6 deletions MapView/Map/RMUserLocation.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,19 @@ - (id)initWithMapView:(RMMapView *)aMapView coordinate:(CLLocationCoordinate2D)a
if ( ! (self = [super initWithMapView:aMapView coordinate:aCoordinate andTitle:aTitle]))
return nil;

layer = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"TrackingDot.png"]];
self.layer = [[[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"TrackingDot.png"]] autorelease];

layer.zPosition = -MAXFLOAT + 2;
self.layer.zPosition = -MAXFLOAT + 2;

annotationType = [kRMUserLocationAnnotationTypeName retain];
self.annotationType = kRMUserLocationAnnotationTypeName;

clusteringEnabled = NO;
self.clusteringEnabled = NO;

return self;
}

- (void)dealloc
{
[layer release]; layer = nil;
[annotationType release]; annotationType = nil;
[location release]; location = nil;
[heading release]; heading = nil;
[super dealloc];
Expand Down

0 comments on commit 2bf35fb

Please sign in to comment.