fixes #99: recognize annotation gestures on user location dot, too
Showing
2 changed files
with
16 additions
and
8 deletions
@@ -81,11 +81,21 @@ | @@ -81,11 +81,21 @@ | ||
81 | if ([annotation.annotationType isEqualToString:kRMTrackingHaloAnnotationTypeName]) | 81 | if ([annotation.annotationType isEqualToString:kRMTrackingHaloAnnotationTypeName]) |
82 | _trackingHaloAnnotation = annotation; | 82 | _trackingHaloAnnotation = annotation; |
83 | 83 | ||
84 | - _userLocationAnnotation.layer.hidden = _accuracyCircleAnnotation.layer.hidden = _trackingHaloAnnotation.layer.hidden = YES; | 84 | + // here we hide the accuracy circle & tracking halo to exclude from hit |
85 | + // testing, as well as be sure to show the user location (even if in | ||
86 | + // heading mode) to ensure hits on it | ||
87 | + // | ||
88 | + BOOL flag = _userLocationAnnotation.layer.isHidden; | ||
89 | + | ||
90 | + _userLocationAnnotation.layer.hidden = NO; | ||
91 | + | ||
92 | + _accuracyCircleAnnotation.layer.hidden = _trackingHaloAnnotation.layer.hidden = YES; | ||
85 | 93 | ||
86 | CALayer *hit = [self.layer hitTest:point]; | 94 | CALayer *hit = [self.layer hitTest:point]; |
87 | 95 | ||
88 | - _userLocationAnnotation.layer.hidden = _accuracyCircleAnnotation.layer.hidden = _trackingHaloAnnotation.layer.hidden = NO; | 96 | + _userLocationAnnotation.layer.hidden = flag; |
97 | + | ||
98 | + _accuracyCircleAnnotation.layer.hidden = _trackingHaloAnnotation.layer.hidden = NO; | ||
89 | 99 | ||
90 | return hit; | 100 | return hit; |
91 | } | 101 | } |
@@ -21,21 +21,19 @@ | @@ -21,21 +21,19 @@ | ||
21 | if ( ! (self = [super initWithMapView:aMapView coordinate:aCoordinate andTitle:aTitle])) | 21 | if ( ! (self = [super initWithMapView:aMapView coordinate:aCoordinate andTitle:aTitle])) |
22 | return nil; | 22 | return nil; |
23 | 23 | ||
24 | - layer = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"TrackingDot.png"]]; | 24 | + self.layer = [[[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"TrackingDot.png"]] autorelease]; |
25 | 25 | ||
26 | - layer.zPosition = -MAXFLOAT + 2; | 26 | + self.layer.zPosition = -MAXFLOAT + 2; |
27 | 27 | ||
28 | - annotationType = [kRMUserLocationAnnotationTypeName retain]; | 28 | + self.annotationType = kRMUserLocationAnnotationTypeName; |
29 | 29 | ||
30 | - clusteringEnabled = NO; | 30 | + self.clusteringEnabled = NO; |
31 | 31 | ||
32 | return self; | 32 | return self; |
33 | } | 33 | } |
34 | 34 | ||
35 | - (void)dealloc | 35 | - (void)dealloc |
36 | { | 36 | { |
37 | - [layer release]; layer = nil; | ||
38 | - [annotationType release]; annotationType = nil; | ||
39 | [location release]; location = nil; | 37 | [location release]; location = nil; |
40 | [heading release]; heading = nil; | 38 | [heading release]; heading = nil; |
41 | [super dealloc]; | 39 | [super dealloc]; |
-
Please register or login to post a comment