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:
@@ -378,11 +378,11 @@ void JNICALL nativeUpdate(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
nativeMapView->getMap().update();
|
||||
}
|
||||
|
||||
void JNICALL nativeOnInvalidate(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
|
||||
void JNICALL nativeOnInvalidate(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jboolean inProgress) {
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeOnInvalidate");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
nativeMapView->onInvalidate();
|
||||
nativeMapView->onInvalidate(inProgress);
|
||||
}
|
||||
|
||||
void JNICALL nativeViewResize(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jint width, jint height) {
|
||||
@@ -1428,7 +1428,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||
{"nativePause", "(J)V", reinterpret_cast<void *>(&nativePause)},
|
||||
{"nativeResume", "(J)V", reinterpret_cast<void *>(&nativeResume)},
|
||||
{"nativeUpdate", "(J)V", reinterpret_cast<void *>(&nativeUpdate)},
|
||||
{"nativeOnInvalidate", "(J)V", reinterpret_cast<void *>(&nativeOnInvalidate)},
|
||||
{"nativeOnInvalidate", "(JZ)V", reinterpret_cast<void *>(&nativeOnInvalidate)},
|
||||
{"nativeViewResize", "(JII)V",
|
||||
reinterpret_cast<void *>(static_cast<void JNICALL (
|
||||
*)(JNIEnv *, jobject, jlong, jint, jint)>(&nativeViewResize))},
|
||||
|
||||
Reference in New Issue
Block a user