Skip to content
Open
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
16 changes: 7 additions & 9 deletions lib/ios/AirMaps/AIRMapMarker.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ - (void)showCalloutView
{
_calloutIsOpen = YES;
[self setZIndex:_zIndexBeforeOpen];

MKAnnotationView *annotationView = [self getAnnotationView];

[self setSelected:YES animated:NO];
Expand Down Expand Up @@ -203,12 +203,12 @@ - (void)addGestureRecognizerToView:(UIView *)view {
- (void)_handleTap:(UITapGestureRecognizer *)recognizer {
AIRMapMarker *marker = self;
if (!marker) return;

if (marker.selected) {
CGPoint touchPoint = [recognizer locationInView:marker.map.calloutView];
CGRect bubbleFrame = [self.calloutView convertRect:marker.map.calloutView.bounds toView:marker.map];
CGPoint touchPointReal = [recognizer locationInView:self.calloutView];

UIView *calloutView = [marker.map.calloutView hitTest:touchPoint withEvent:nil];
if (calloutView) {
// the callout (or its subview) got clicked, not the marker
Expand All @@ -222,7 +222,7 @@ - (void)_handleTap:(UITapGestureRecognizer *)recognizer {
}
tmp = tmp.superview;
}

id event = @{
@"action": calloutSubview ? @"callout-inside-press" : @"callout-press",
@"id": marker.identifier ?: @"unknown",
Expand All @@ -237,15 +237,15 @@ - (void)_handleTap:(UITapGestureRecognizer *)recognizer {
@"height": @(bubbleFrame.size.height),
}
};

if (calloutSubview) calloutSubview.onPress(event);
if (marker.onCalloutPress) marker.onCalloutPress(event);
if (marker.calloutView && marker.calloutView.onPress) marker.calloutView.onPress(event);
if (marker.map.onCalloutPress) marker.map.onCalloutPress(event);
return;
}
}

// the actual marker got clicked
id event = @{
@"action": @"marker-press",
Expand All @@ -255,11 +255,9 @@ - (void)_handleTap:(UITapGestureRecognizer *)recognizer {
@"longitude": @(marker.coordinate.longitude)
}
};

if (marker.onPress) marker.onPress(event);
if (marker.map.onMarkerPress) marker.map.onMarkerPress(event);

[marker.map selectAnnotation:marker animated:NO];
}

- (void)hideCalloutView
Expand Down