Avoid nudging transitions if a gesture is in progress

We're now using nudgeTransitions() to tell the Map view that we want to
update it. However, if we're on a gesture movement, the update() call
can get called too fast and causing general slowdown. This check ensures
we only call for nudgeTransitions() after all gesture events are
finished. Fixes the issue pointed out by #1548 on Android.
This commit is contained in:
Bruno de Oliveira Abinader
2015-07-23 17:43:01 +03:00
parent 7b47fa8dab
commit 3512da9609
5 changed files with 14 additions and 10 deletions

View File

@@ -758,12 +758,15 @@ void NativeMapView::updateFps() {
env = nullptr;
}
void NativeMapView::onInvalidate() {
void NativeMapView::onInvalidate(bool inProgress) {
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::onInvalidate()");
const bool dirty = !clean.test_and_set();
if (dirty) {
map.renderSync();
const bool needsRerender = map.renderSync();
if (!inProgress) {
map.nudgeTransitions(needsRerender);
}
}
}