From 9b6ea527225a5a99f8c8f8ad61e984b7bafb8b10 Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Mon, 23 Mar 2015 17:13:47 -0500 Subject: [PATCH] #1033 - Adding map.dragend event --- platform/ios/MGLMapView.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index 3aa0ef2e0..cd25dda0b 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -659,6 +659,16 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr; [weakSelf notifyMapChange:@(mbgl::MapChangeRegionDidChangeAnimated)]; }]; } + + // Send Map Drag End Event + CGPoint ptInView = CGPointMake([pan locationInView:pan.view].x, [pan locationInView:pan.view].y); + CLLocationCoordinate2D coord = [self convertPoint:ptInView toCoordinateFromView:pan.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.dragend" withAttributes:dict]; } }