summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2015-03-25 20:35:51 -0500
committerBrad Leege <bleege@gmail.com>2015-03-25 20:35:51 -0500
commit4408f4260b8beb60b138e13ca548dd87a7191458 (patch)
tree1e35da4a95ddfcd228c5fb8b6a1307b70bccd838
parentc7b8cb1477139da834a5ceef051d9df375bfeb03 (diff)
downloadqtlocation-mapboxgl-4408f4260b8beb60b138e13ca548dd87a7191458.tar.gz
#1109 - Wrapping gesture event logic in background queue
-rw-r--r--platform/ios/MGLMapView.mm22
1 files changed, 12 insertions, 10 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index 30edd87977..63f0fcdd16 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -987,16 +987,18 @@ mbgl::DefaultFileSource *mbglFileSource = nullptr;
- (void) trackGestureEvent:(NSString *) gesture forRecognizer:(UIGestureRecognizer *) recognizer
{
- // Send Map Zoom Event
- CGPoint ptInView = CGPointMake([recognizer locationInView:recognizer.view].x, [recognizer locationInView:recognizer.view].y);
- CLLocationCoordinate2D coord = [self convertPoint:ptInView toCoordinateFromView:recognizer.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"];
- [dict setValue:gesture forKey:@"gesture"];
-
- [[MGLMapboxEvents sharedManager] pushEvent:@"map.click" withAttributes:dict];
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
+ // Send Map Zoom Event
+ CGPoint ptInView = CGPointMake([recognizer locationInView:recognizer.view].x, [recognizer locationInView:recognizer.view].y);
+ CLLocationCoordinate2D coord = [self convertPoint:ptInView toCoordinateFromView:recognizer.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"];
+ [dict setValue:gesture forKey:@"gesture"];
+
+ [[MGLMapboxEvents sharedManager] pushEvent:@"map.click" withAttributes:dict];
+ });
}
#pragma mark - Properties -