@@ -46,12 +46,13 @@ const ProgressInfoView: React.FC<PageInfoProps> = ({
|
||||
: '{current} / {total}'
|
||||
: '{percent}%';
|
||||
|
||||
const { page = 0, pages = 0, atEnd = false } = view?.renderer || {};
|
||||
const lang = localStorage?.getItem('i18nextLng') || '';
|
||||
const localize = isVertical && lang.toLowerCase().startsWith('zh');
|
||||
const pageInfo = bookData?.isFixedLayout ? section : pageinfo;
|
||||
const progressInfo = formatProgress(pageInfo?.current, pageInfo?.total, template, localize, lang);
|
||||
const currentPage = atEnd && pageInfo?.total ? pageInfo.total - 1 : pageInfo?.current;
|
||||
const progressInfo = formatProgress(currentPage, pageInfo?.total, template, localize, lang);
|
||||
|
||||
const { page = 0, pages = 0 } = view?.renderer || {};
|
||||
const current = page;
|
||||
const total = pages;
|
||||
const pagesLeft = Math.max(total - current - 1, 0);
|
||||
|
||||
@@ -61,6 +61,8 @@ export interface FoliateView extends HTMLElement {
|
||||
end: number;
|
||||
page: number;
|
||||
pages: number;
|
||||
atStart: boolean;
|
||||
atEnd: boolean;
|
||||
containerPosition: number;
|
||||
sideProp: 'width' | 'height';
|
||||
setAttribute: (name: string, value: string | number) => void;
|
||||
|
||||
@@ -14,7 +14,12 @@ export function formatProgress(
|
||||
return template
|
||||
.replace('{current}', currentStr)
|
||||
.replace('{total}', totalStr)
|
||||
.replace('{percent}', (((current + 1) / total) * 100).toFixed(fractionDigits));
|
||||
.replace(
|
||||
'{percent}',
|
||||
(((current + 1) / total) * 100).toFixed(
|
||||
current + 1 < total && total > 100 ? fractionDigits : 0,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
+1
-1
Submodule packages/foliate-js updated: 6f4a5177bc...53a914894a
Reference in New Issue
Block a user