fix sustain opacity

This commit is contained in:
monoid 2024-04-07 22:35:59 +09:00
parent eb83e221e4
commit 4a38cad0a4

View File

@ -39,10 +39,14 @@ function ComicViewer({
useEffect(() => {
if(currentImageRef.current){
if (curPage < 0 || curPage >= totalPage) {
return;
}
const img = new Image();
img.src = `/api/doc/${doc.id}/comic/${curPage}`;
if (img.complete) {
currentImageRef.current.src = img.src;
setFade(false);
return;
}
setFade(true);
@ -60,7 +64,7 @@ function ComicViewer({
// TODO: use web worker to abort loading image in the future
};
}
}, [curPage, doc.id]);
}, [curPage, doc.id, totalPage]);
return (
<div className="overflow-hidden w-full h-full relative">