From 14c4ce75e194aae49077ea4d9e94fdd9cc45cdfa Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Mon, 23 Mar 2015 13:22:06 -0500 Subject: [PATCH] #1033 - First Map Zoom (aka `map.click` event) --- platform/ios/MGLMapView.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index fe835f7fe..7e2343b74 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -865,6 +865,16 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; [weakSelf unrotateIfNeededAnimated:YES]; [weakSelf notifyMapChange:@(mbgl::MapChangeRegionDidChangeAnimated)]; + + // Send Map Zoom Event + CGPoint ptInView = CGPointMake([doubleTap locationInView:doubleTap.view].x, [doubleTap locationInView:doubleTap.view].y); + CLLocationCoordinate2D coord = [self convertPoint:ptInView toCoordinateFromView:doubleTap.view]; + NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; + [dict setValue:[[NSNumber alloc] initWithDouble:coord.latitude] forKey:@"lat"]; + [dict setValue:[[NSNumber alloc] initWithDouble:coord.longitude] forKey:@"lng"]; + [dict setValue:[[NSNumber alloc] initWithDouble:[weakSelf zoomLevel]] forKey:@"zoom"]; + + [[MGLMapboxEvents sharedManager] pushEvent:@"map.click" withAttributes:dict]; }]; } }