mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
修复web阅读翻页动画未完成时再次触发翻页导致页面抽搐的问题
This commit is contained in:
parent
c1facb5f72
commit
07d294ac04
@ -403,8 +403,10 @@ const onReachBottom = (entries) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let canJump = true;
|
||||||
// 监听方向键
|
// 监听方向键
|
||||||
const handleKeyPress = (event) => {
|
const handleKeyPress = (event) => {
|
||||||
|
if (!canJump) return;
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "ArrowLeft":
|
case "ArrowLeft":
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@ -425,8 +427,10 @@ const handleKeyPress = (event) => {
|
|||||||
type: "warn",
|
type: "warn",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
canJump = false;
|
||||||
jump(0 - document.documentElement.clientHeight + 100, {
|
jump(0 - document.documentElement.clientHeight + 100, {
|
||||||
duration: store.config.jumpDuration,
|
duration: store.config.jumpDuration,
|
||||||
|
callback: () => (canJump = true),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -443,8 +447,10 @@ const handleKeyPress = (event) => {
|
|||||||
type: "warn",
|
type: "warn",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
canJump = false;
|
||||||
jump(document.documentElement.clientHeight - 100, {
|
jump(document.documentElement.clientHeight - 100, {
|
||||||
duration: store.config.jumpDuration,
|
duration: store.config.jumpDuration,
|
||||||
|
callback: () => (canJump = true),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user