From 3a9ef771f8e57e63cb8fe5f457ba4445ab80e7cc Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Fri, 24 Jul 2015 16:24:20 +0300 Subject: [PATCH] Avoid nudging transitions if a gesture is in progress #2 Following the same steps from #1548 and #1912 for GLFW and iOS ports. Also removed a redundant check if transform state is changing since we're already dealing with that. --- platform/default/glfw_view.cpp | 5 ++++- platform/ios/MGLMapView.mm | 6 ++++++ src/mbgl/renderer/painter.cpp | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/platform/default/glfw_view.cpp b/platform/default/glfw_view.cpp index e83a8327281..49ae8c4f684 100644 --- a/platform/default/glfw_view.cpp +++ b/platform/default/glfw_view.cpp @@ -336,7 +336,10 @@ void GLFWView::run() { const bool dirty = !clean.test_and_set(); if (dirty) { const bool needsRerender = map->renderSync(); - map->nudgeTransitions(needsRerender); + GLFWView *view = reinterpret_cast(glfwGetWindowUserPointer(window)); + if (!view->tracking || !view->rotating) { + map->nudgeTransitions(needsRerender); + } } } } diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index f4dea9baebe..0cce29ba1d3 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -707,6 +707,12 @@ - (void)glkView:(__unused GLKView *)view drawInRect:(__unused CGRect)rect [self updateUserLocationAnnotationView]; + // don't nudge transitions if in the midst of a gesture. + if (self.pan.state == UIGestureRecognizerStateChanged || + self.pinch.state == UIGestureRecognizerStateChanged || + self.rotate.state == UIGestureRecognizerStateChanged || + self.quickZoom.state == UIGestureRecognizerStateChanged) return; + _mbglMap->nudgeTransitions(needsRerender); } } diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index 7570b6a74dd..db0393b003d 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -49,7 +49,7 @@ Painter::~Painter() { } bool Painter::needsAnimation() const { - return frameHistory.needsAnimation(data.getDefaultFadeDuration()) || state.isChanging(); + return frameHistory.needsAnimation(data.getDefaultFadeDuration()); } void Painter::setup() {