From 4b5158d0fecdfd7cbf97d02cffd7bf3929bbfe2e Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Mon, 23 Mar 2015 13:30:49 -0500 Subject: [PATCH] #1033 - Add Quick Zoom Event --- platform/ios/MGLMapView.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 6ba95e61b..bd6312c12 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -943,6 +943,16 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; [self unrotateIfNeededAnimated:YES]; [self notifyMapChange:@(mbgl::MapChangeRegionDidChangeAnimated)]; + + // Send Map Zoom Event + CGPoint ptInView = CGPointMake([quickZoom locationInView:quickZoom.view].x, [quickZoom locationInView:quickZoom.view].y); + CLLocationCoordinate2D coord = [self convertPoint:ptInView toCoordinateFromView:quickZoom.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:[self zoomLevel]] forKey:@"zoom"]; + + [[MGLMapboxEvents sharedManager] pushEvent:@"map.click" withAttributes:dict]; } }