Limit overscoll delta Y

This commit is contained in:
M66B 2022-06-24 20:29:56 +02:00
parent bb8c7ecafe
commit d81f7fb2ea
1 changed files with 14 additions and 1 deletions

View File

@ -295,7 +295,20 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
clampedY = true;
}
Log.i("onOverScrolled clamped=" + clampedY + " new=" + newScrollY + " dy=" + deltaY);
Log.i("onOverScrolled" +
" clampedY=" + clampedY +
" scrollY=" + scrollY +
" deltaY=" + deltaY +
" RangeY=" + scrollRangeY +
" maxY=" + maxOverScrollY +
" newY=" + (scrollY + deltaY) + "/" + newScrollY +
" dy=" + deltaY +
" top=" + top +
" bottom=" + bottom);
if (Math.abs(deltaY) > bottom - top)
deltaY = (deltaY > 0 ? 1 : -1) * (bottom - top);
intf.onOverScrolled(scrollX, scrollY, deltaX, deltaY, clampedX, clampedY);
return super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);