#1033 - First Map Zoom (aka map.click event)

This commit is contained in:
Brad Leege
2015-03-23 13:22:06 -05:00
parent 11eebc498f
commit 14c4ce75e1

View File

@@ -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];
}];
}
}