Fixed original view scrolling issues

This commit is contained in:
M66B 2023-04-06 21:41:32 +02:00
parent dbd88712b7
commit 65caca4bab
1 changed files with 14 additions and 12 deletions

View File

@ -316,18 +316,20 @@ public class WebViewEx extends WebView implements DownloadListener, View.OnLongC
intercept = (yoff > 0 || dy >= 0) && (yoff < bottom || dy <= 0);
}
int xrange = computeHorizontalScrollRange();
int xextend = computeHorizontalScrollExtent();
boolean canScrollHorizontal = (xrange > xextend);
if (canScrollHorizontal) {
int right = xrange - xextend;
int xoff = computeHorizontalScrollOffset();
int ldx = xoff - lastXoff;
float dx = lastX - event.getX();
intercept = (xoff > 0 || dx >= 0) &&
(xoff < right || dx <= 0) &&
(Math.signum(dx) == Math.signum(ldx));
lastXoff = xoff;
if (!intercept) {
int xrange = computeHorizontalScrollRange();
int xextend = computeHorizontalScrollExtent();
boolean canScrollHorizontal = (xrange > xextend);
if (canScrollHorizontal) {
int right = xrange - xextend;
int xoff = computeHorizontalScrollOffset();
int ldx = xoff - lastXoff;
float dx = lastX - event.getX();
intercept = (xoff > 0 || dx >= 0) &&
(xoff < right || dx <= 0) &&
(Math.signum(dx) == Math.signum(ldx));
lastXoff = xoff;
}
}
}
getParent().requestDisallowInterceptTouchEvent(intercept || event.getPointerCount() > 1);