fix bug
This commit is contained in:
@@ -199,7 +199,11 @@ const BookViewer: FC<BookViewerProps> = ({ pages, catalogSize, documentSettings
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
resetEntrance();
|
resetEntrance();
|
||||||
}, [flipKey, pages.length, pages[0]?.id, resetEntrance]);
|
const frame = requestAnimationFrame(() => {
|
||||||
|
commitEntranceAtCurrentSpread();
|
||||||
|
});
|
||||||
|
return () => cancelAnimationFrame(frame);
|
||||||
|
}, [flipKey, pages.length, pages[0]?.id, resetEntrance, commitEntranceAtCurrentSpread]);
|
||||||
|
|
||||||
// اطمینان از اینکه currentPage همیشه در محدوده معتبر است
|
// اطمینان از اینکه currentPage همیشه در محدوده معتبر است
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -306,8 +310,10 @@ const BookViewer: FC<BookViewerProps> = ({ pages, catalogSize, documentSettings
|
|||||||
const clamped = Math.max(0, Math.min(p, pages.length - 1));
|
const clamped = Math.max(0, Math.min(p, pages.length - 1));
|
||||||
setCurrentPage(clamped);
|
setCurrentPage(clamped);
|
||||||
lastFlipPageRef.current = clamped;
|
lastFlipPageRef.current = clamped;
|
||||||
|
// اولین اسپرد قبل از onChangeState('read') هم باید انیمیشن ورود بگیرد
|
||||||
|
scheduleEntranceForSpread(clamped);
|
||||||
},
|
},
|
||||||
[pages.length],
|
[pages.length, scheduleEntranceForSpread],
|
||||||
);
|
);
|
||||||
|
|
||||||
/** بعد از اتمام انیمیشن ورق، ایندکس واقعی کتاب را میگیریم و انیمیشن ورود را یکبار شروع میکنیم */
|
/** بعد از اتمام انیمیشن ورق، ایندکس واقعی کتاب را میگیریم و انیمیشن ورود را یکبار شروع میکنیم */
|
||||||
|
|||||||
Reference in New Issue
Block a user