Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Avoid nudging transitions if a gesture is in progress #2
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brunoabinader committed Jul 27, 2015
1 parent 44182a3 commit 5e2f3b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion platform/default/glfw_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions platform/ios/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/renderer/painter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 5e2f3b1

Please sign in to comment.