Skip to content

Instantly share code, notes, and snippets.

@incanus
Created June 29, 2015 21:16
Show Gist options
  • Save incanus/41d85a875b032558a6ec to your computer and use it in GitHub Desktop.
Save incanus/41d85a875b032558a6ec to your computer and use it in GitHub Desktop.
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index c6e6bfd..81c8313 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -79,6 +79,7 @@ CLLocationDegrees MGLDegreesFromRadians(CGFloat radians)
@property (nonatomic) UIPinchGestureRecognizer *pinch;
@property (nonatomic) UIRotationGestureRecognizer *rotate;
@property (nonatomic) UILongPressGestureRecognizer *quickZoom;
+@property (nonatomic) UILongPressGestureRecognizer *longPress;
@property (nonatomic) NSMapTable *annotationIDsByAnnotation;
@property (nonatomic) std::vector<uint32_t> annotationsNearbyLastTap;
@property (nonatomic, weak) id <MGLAnnotation> selectedAnnotation;
@@ -368,6 +369,9 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
[self addGestureRecognizer:_quickZoom];
}
+ _longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
+ [self addGestureRecognizer:_longPress];
+
// observe app activity
//
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sleepGL:) name:UIApplicationWillResignActiveNotification object:nil];
@@ -881,6 +885,13 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
self.animatingGesture = NO;
}
+- (void)handleLongPress:(UILongPressGestureRecognizer *)longPress
+{
+ if (longPress.state != UIGestureRecognizerStateEnded) return;
+
+ _mbglMap->moveBy(200, 200, secondsAsDuration(1));
+}
+
- (void)handlePanGesture:(UIPanGestureRecognizer *)pan
{
if ( ! self.isScrollEnabled) return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment