修复web阅读翻页动画未完成时再次触发翻页导致页面抽搐的问题

This commit is contained in:
StanHustler 2023-09-23 21:17:21 +08:00 committed by Strato69
parent c1facb5f72
commit 07d294ac04

View File

@ -403,8 +403,10 @@ const onReachBottom = (entries) => {
}
};
let canJump = true;
//
const handleKeyPress = (event) => {
if (!canJump) return;
switch (event.key) {
case "ArrowLeft":
event.stopPropagation();
@ -425,8 +427,10 @@ const handleKeyPress = (event) => {
type: "warn",
});
} else {
canJump = false;
jump(0 - document.documentElement.clientHeight + 100, {
duration: store.config.jumpDuration,
callback: () => (canJump = true),
});
}
break;
@ -443,8 +447,10 @@ const handleKeyPress = (event) => {
type: "warn",
});
} else {
canJump = false;
jump(document.documentElement.clientHeight - 100, {
duration: store.config.jumpDuration,
callback: () => (canJump = true),
});
}
break;