PullDownToRefresh: fix wheeling switch page

This commit is contained in:
thislight 2024-10-09 18:14:09 +08:00
parent bcfb846115
commit d44a90ab49
No known key found for this signature in database
GPG key ID: A50F9451AC56A63E

View file

@ -95,7 +95,7 @@ const PullDownToRefresh: Component<{
const scrollTop = (event.target as HTMLElement).scrollTop;
if (scrollTop >= 0 && scrollTop < 1) {
const d = untrack(pullDown);
if (event.deltaY <= 0 || d > 0) event.preventDefault();
if (d > 1) event.preventDefault();
ds = -(event.deltaY / window.devicePixelRatio / 2);
holding = d < stopPos();
if (wheelTimeout) {
@ -129,7 +129,6 @@ const PullDownToRefresh: Component<{
return;
}
const item = event.targetTouches.item(0)!;
if (untrack(pullDown) > 0) event.preventDefault();
if (lastTouchId && item.identifier !== lastTouchId) {
lastTouchId = undefined;
lastTouchScreenY = 0;
@ -140,6 +139,7 @@ const PullDownToRefresh: Component<{
if (lastTouchScreenY !== 0) {
ds = item.screenY - lastTouchScreenY;
}
if (Math.abs(ds) > 1 && untrack(pullDown) > 1) event.preventDefault();
lastTouchScreenY = item.screenY;
if (released) {
released = false;