hasMultiplePages
This commit is contained in:
@@ -109,6 +109,7 @@ const BookViewer: FC<BookViewerProps> = ({ pages, catalogSize, documentSettings
|
||||
);
|
||||
const displayWidth = Math.round(bookWidth * VIEWER_SCALE);
|
||||
const displayHeight = Math.round(bookHeight * VIEWER_SCALE);
|
||||
const hasMultiplePages = pages.length > 1;
|
||||
|
||||
// موبایل: از ابعاد viewport برای جا دادن کتاب در صفحه
|
||||
const [viewport, setViewport] = useState(() =>
|
||||
@@ -290,6 +291,7 @@ const BookViewer: FC<BookViewerProps> = ({ pages, catalogSize, documentSettings
|
||||
}, [isAutoPlayActive]);
|
||||
|
||||
const handleLinkClick = useCallback((linkUrl: string) => {
|
||||
if (pages.length <= 1) return;
|
||||
if (linkUrl.startsWith('page://')) {
|
||||
const action = linkUrl.replace('page://', '');
|
||||
const pageFlipAPI = bookRef.current?.pageFlip() as PageFlipWithFlipController | undefined;
|
||||
@@ -432,13 +434,13 @@ const BookViewer: FC<BookViewerProps> = ({ pages, catalogSize, documentSettings
|
||||
startPage={startPage}
|
||||
autoSize={false}
|
||||
maxShadowOpacity={isDesktop ? 0.5 : 0}
|
||||
showCover={true}
|
||||
showCover={hasMultiplePages}
|
||||
mobileScrollSupport={!usePortrait}
|
||||
clickEventForward={true}
|
||||
useMouseEvents={true}
|
||||
swipeDistance={usePortrait ? 48 : 30}
|
||||
useMouseEvents={hasMultiplePages}
|
||||
swipeDistance={hasMultiplePages ? (usePortrait ? 48 : 30) : 9999}
|
||||
startZIndex={1}
|
||||
showPageCorners={true}
|
||||
showPageCorners={hasMultiplePages}
|
||||
disableFlipByClick={true}
|
||||
className="flipbook-container mx-auto max-w-full"
|
||||
style={{}}
|
||||
@@ -464,6 +466,8 @@ const BookViewer: FC<BookViewerProps> = ({ pages, catalogSize, documentSettings
|
||||
</div>
|
||||
|
||||
<div className="shrink-0 max-md:min-h-12 flex items-center gap-3 md:gap-6 bg-white rounded-full px-4 md:px-6 py-2 md:py-3 shadow-lg">
|
||||
{hasMultiplePages && (
|
||||
<>
|
||||
{/* دکمه راست: فارسی = صفحه بعد | لاتین = صفحه قبل */}
|
||||
<button
|
||||
type="button"
|
||||
@@ -481,6 +485,8 @@ const BookViewer: FC<BookViewerProps> = ({ pages, catalogSize, documentSettings
|
||||
>
|
||||
<ArrowRight2 color='black' size={20} className="text-gray-700 md:w-6 md:h-6" />
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* شماره صفحه */}
|
||||
<div className="flex items-center gap-2 min-w-[100px] md:min-w-[120px] justify-center">
|
||||
@@ -489,6 +495,8 @@ const BookViewer: FC<BookViewerProps> = ({ pages, catalogSize, documentSettings
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{hasMultiplePages && (
|
||||
<>
|
||||
{/* دکمه چپ: فارسی = صفحه قبل | لاتین = صفحه بعد */}
|
||||
<button
|
||||
type="button"
|
||||
@@ -506,6 +514,8 @@ const BookViewer: FC<BookViewerProps> = ({ pages, catalogSize, documentSettings
|
||||
>
|
||||
<ArrowLeft2 color='black' size={20} className="text-gray-700 md:w-6 md:h-6" />
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user