From 8b2d18814e049678808de3aa82dac9919a20ddaa Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Mon, 23 Mar 2015 13:25:39 -0500 Subject: [PATCH] #1033 - Map Zoom out event --- platform/ios/MGLMapView.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 7e2343b74..6ba95e61b 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -902,6 +902,16 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; [weakSelf unrotateIfNeededAnimated:YES]; [weakSelf notifyMapChange:@(mbgl::MapChangeRegionDidChangeAnimated)]; + + // Send Map Zoom Event + CGPoint ptInView = CGPointMake([twoFingerTap locationInView:twoFingerTap.view].x, [twoFingerTap locationInView:twoFingerTap.view].y); + CLLocationCoordinate2D coord = [self convertPoint:ptInView toCoordinateFromView:twoFingerTap.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]; }]; } }