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.
This commit is contained in:
Bruno de Oliveira Abinader
2015-07-24 16:24:20 +03:00
parent 44182a30cf
commit 5e2f3b1323
3 changed files with 11 additions and 2 deletions

View File

@@ -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<GLFWView *>(glfwGetWindowUserPointer(window));
if (!view->tracking || !view->rotating) {
map->nudgeTransitions(needsRerender);
}
}
}
}

View File

@@ -707,6 +707,12 @@ std::chrono::steady_clock::duration secondsAsDuration(float duration)
[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);
}
}

View File

@@ -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() {