@react-pdf-kit/viewer 2.8.0-beta.5 → 2.8.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AnnotationLayer-CAIvKf_O.js → AnnotationLayer-Dl6VxRzL.js} +2 -2
- package/dist/{Button-DBu3SaMk.js → Button-BNlmxWrV.js} +1 -1
- package/dist/CanvasLayer-cRwL_IIT.js +105 -0
- package/dist/{Checkbox-CSIEUyO8.js → Checkbox-Brta-YKG.js} +4 -4
- package/dist/{Combination-11kyhTGt.js → Combination-DqNkTtir.js} +15 -15
- package/dist/{Container-BuamPhw4.js → Container-BxNZX82X.js} +1 -1
- package/dist/{DocumentDialog-cRr9sSSH.js → DocumentDialog-C9G7lVTh.js} +4 -4
- package/dist/{DropDown-CM6xEwZC.js → DropDown-DikL-krI.js} +2 -2
- package/dist/{Input-Dpo1Xfxe.js → Input-DjSWOjCI.js} +1 -1
- package/dist/{LoaderIcon-B3ddfd0D.js → LoaderIcon-D9YjinGf.js} +1 -1
- package/dist/{LoadingIndicator-Bzzf28Xv.js → LoadingIndicator-B_Jsf8No.js} +8 -8
- package/dist/MenuItem-D-GflAAo.js +31 -0
- package/dist/{MenuSeparator-CaFxd8b5.js → MenuSeparator-D1H5l8Ej.js} +1 -1
- package/dist/{PaginationContext-Cwf8sCpK.js → PaginationContext-B3qzCYJu.js} +46 -53
- package/dist/{PasswordModal-BtHVvrMg.js → PasswordModal-BW_C2ULg.js} +12 -12
- package/dist/{RPDropFileZone-Bq1bzWmO.js → RPDropFileZone-D1C3ouep.js} +1 -1
- package/dist/RPLayout.module-DCbTHUuG.js +14 -0
- package/dist/{RPPages-DeA52_rv.js → RPPages-5yXo7yhq.js} +624 -324
- package/dist/{RPTooltip-CXBVXusS.js → RPTooltip-COLVx-C_.js} +127 -95
- package/dist/SearchTool.module-DY8Ucfb_.js +17 -0
- package/dist/{SkipLink-CdcjClGB.js → SkipLink-Dj83gZdk.js} +3 -3
- package/dist/{TextLayer-DWGFN9SF.js → TextLayer-BdoXGj0Z.js} +5 -5
- package/dist/{Thumbnail-DyRfHsAh.js → Thumbnail-BVjnCNxv.js} +8 -8
- package/dist/{Thumbnails-Cbr54TOa.js → Thumbnails-CrKLESh3.js} +2 -2
- package/dist/assets/AnnotationLayer.css +1 -1
- package/dist/assets/CanvasLayer.css +1 -0
- package/dist/assets/LoadingIndicator.css +1 -1
- package/dist/assets/MenuItem.css +1 -1
- package/dist/assets/PasswordModal.css +1 -1
- package/dist/assets/RPLayout.css +1 -1
- package/dist/assets/SearchTool.css +1 -1
- package/dist/assets/SkipLink.css +1 -1
- package/dist/assets/TextLayer.css +1 -1
- package/dist/assets/Thumbnail.css +1 -1
- package/dist/assets/style.js +1 -1
- package/dist/{clsx-DSGuh5YW.js → clsx-B7LyVm5O.js} +1 -1
- package/dist/components/RPController.js +1 -1
- package/dist/components/RPDropFileZone.js +1 -1
- package/dist/components/RPPages.js +1 -1
- package/dist/components/RPProvider.js +1 -1
- package/dist/components/icons/LoaderIcon.js +1 -1
- package/dist/components/layout/Container.js +1 -1
- package/dist/components/layout/LayoutContainer.js +2 -2
- package/dist/components/layout/LayoutWrapper.js +1 -1
- package/dist/components/layout/RPDefaultLayout.js +4 -4
- package/dist/components/layout/RPLayout.js +4 -4
- package/dist/components/layout/SkipLink.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +3 -3
- package/dist/components/layout/sidebar/Thumbnail.js +1 -1
- package/dist/components/layout/sidebar/Thumbnails.js +1 -1
- package/dist/components/layout/toolbar/DarkModeTool.js +2 -2
- package/dist/components/layout/toolbar/DocumentDialog.js +1 -1
- package/dist/components/layout/toolbar/DocumentProperties.js +7 -7
- package/dist/components/layout/toolbar/FileDownloadTool.js +7 -7
- package/dist/components/layout/toolbar/FileUploadTool.js +7 -7
- package/dist/components/layout/toolbar/FullScreenTool.js +10 -9
- package/dist/components/layout/toolbar/MenuItem.js +1 -1
- package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
- package/dist/components/layout/toolbar/MostPageTool.js +25 -31
- package/dist/components/layout/toolbar/OtherTool.js +6 -6
- package/dist/components/layout/toolbar/Paginate.js +5 -4
- package/dist/components/layout/toolbar/PrintTool.js +7 -7
- package/dist/components/layout/toolbar/RPMenuItem.js +3 -3
- package/dist/components/layout/toolbar/RPMoreOptions.js +6 -6
- package/dist/components/layout/toolbar/RPToolbar.js +1 -1
- package/dist/components/layout/toolbar/RotateTool.js +12 -12
- package/dist/components/layout/toolbar/ScrollModeTool.js +16 -16
- package/dist/components/layout/toolbar/SearchCloseButton.js +3 -3
- package/dist/components/layout/toolbar/SearchResultNavigator.js +3 -3
- package/dist/components/layout/toolbar/SearchTool.js +134 -122
- package/dist/components/layout/toolbar/SelectionModeTool.js +12 -12
- package/dist/components/layout/toolbar/ThumbnailTool.js +2 -2
- package/dist/components/layout/toolbar/ToolbarCustom.js +2 -2
- package/dist/components/layout/toolbar/ToolbarDefault.js +2 -2
- package/dist/components/layout/toolbar/ViewModeTool.js +18 -18
- package/dist/components/layout/toolbar/ZoomTool.js +86 -84
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +3 -3
- package/dist/components/layout/toolbar/tools/DualPageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +2 -2
- package/dist/components/layout/toolbar/tools/InputPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/LastPageTool.js +1 -1
- package/dist/components/layout/toolbar/tools/NextPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +2 -2
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +3 -3
- package/dist/components/layout/toolbar/tools/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +2 -2
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +2 -2
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +2 -2
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +2 -2
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +2 -2
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +25 -23
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +1 -1
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +6 -6
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +25 -23
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +5 -5
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +2 -2
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +4 -4
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +3 -3
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +4 -4
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +4 -4
- package/dist/components/page/AnnotationLayer.js +1 -1
- package/dist/components/page/CanvasLayer.js +2 -48
- package/dist/components/page/DualPage.js +2 -2
- package/dist/components/page/DualPageWithCover.js +2 -2
- package/dist/components/page/RPPage.js +94 -2
- package/dist/components/page/SinglePage.js +2 -2
- package/dist/components/page/TextLayer.js +1 -1
- package/dist/components/ui/Button.js +1 -1
- package/dist/components/ui/Checkbox.js +1 -1
- package/dist/components/ui/DropDown.js +1 -1
- package/dist/components/ui/Input.js +1 -1
- package/dist/components/ui/LoadingIndicator.js +1 -1
- package/dist/components/ui/PasswordModal.js +1 -1
- package/dist/components/ui/RPTooltip.js +1 -1
- package/dist/contexts/DimensionPagesContext.js +38 -22
- package/dist/contexts/ElementThumbnailContext.js +1 -1
- package/dist/contexts/LoaderContext.js +1 -1
- package/dist/contexts/PaginationContext.js +1 -1
- package/dist/contexts/RenderQueueProvider.js +11 -7
- package/dist/contexts/ZoomContext.js +119 -61
- package/dist/{de_DE-DwUvXUWH.js → de_DE-C1OrwQKj.js} +18 -0
- package/dist/{dist-B2hwhF6G.js → dist-7FA4Do6I.js} +7 -7
- package/dist/{dist-BfuBBQ14.js → dist-BRVqFn7R.js} +6 -6
- package/dist/{dist-CNbFpoT1.js → dist-C3WNMuW2.js} +2 -2
- package/dist/{dist-VbpVNBs6.js → dist-CKteKPPA.js} +7 -7
- package/dist/{dist-CgoP608h.js → dist-bK-AHWLF.js} +7 -7
- package/dist/icons.js +1 -1
- package/dist/{main-Zah9b8M8.js → main-CdlJS0xf.js} +3 -3
- package/dist/main.js +5 -5
- package/dist/style-CWQAmimK.js +5 -0
- package/dist/types/components/ui/RPTooltip.d.ts +3 -2
- package/dist/types/contexts/RenderQueueProvider.d.ts +2 -0
- package/dist/types/locales/de_DE.json.d.ts +3 -0
- package/dist/types/locales/en_US.json.d.ts +3 -0
- package/dist/types/locales/it_IT.json.d.ts +3 -0
- package/dist/types/locales/pt_PT.json.d.ts +3 -0
- package/dist/types/locales/th_TH.json.d.ts +3 -0
- package/dist/types/locales/zh_CN.json.d.ts +3 -0
- package/dist/types/utils/Queue.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +8 -0
- package/dist/types/utils/hooks/usePinch.d.ts +14 -1
- package/dist/types/utils/hooks/useZoomOrigin.d.ts +4 -0
- package/dist/types/utils/types.d.ts +17 -1
- package/dist/types/utils/zoom.d.ts +2 -0
- package/dist/utils/Queue.js +5 -0
- package/dist/utils/constants.js +2 -2
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLocalization.js +1 -1
- package/dist/utils/hooks/usePaginate.js +1 -1
- package/dist/utils/hooks/usePinch.js +102 -56
- package/dist/utils/hooks/usePresentPage.js +23 -19
- package/dist/utils/hooks/useScrollToPage.js +1 -1
- package/dist/utils/hooks/useSearch.js +1 -1
- package/dist/utils/hooks/useZoomOrigin.js +37 -0
- package/dist/utils/renderPage.js +21 -14
- package/dist/utils/types.js +2 -2
- package/dist/utils/zoom.js +8 -2
- package/package.json +1 -1
- package/dist/MenuItem-9kCH_GQ0.js +0 -15
- package/dist/RPLayout.module-Vc3h4xxS.js +0 -14
- package/dist/RPPage-C_r8aeTc.js +0 -91
- package/dist/SearchTool.module-DUkVXfOn.js +0 -16
- package/dist/assets/RPPage.css +0 -1
- package/dist/style-C8T5x1fE.js +0 -5
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Queue } from '../utils/Queue';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { PDFPageProxy } from 'pdfjs-dist';
|
|
4
|
+
import { RenderTask } from 'pdfjs-dist/types/src/display/api';
|
|
4
5
|
import { RenderOptions } from '../utils/types';
|
|
5
6
|
interface RenderData {
|
|
6
7
|
page: PDFPageProxy;
|
|
7
8
|
canvasElem: HTMLCanvasElement;
|
|
8
9
|
options?: RenderOptions;
|
|
9
10
|
onLoaded?: () => void;
|
|
11
|
+
onRenderTask?: (task: RenderTask | null) => void;
|
|
10
12
|
}
|
|
11
13
|
export declare const RenderQueueContext: import('react').Context<Queue<RenderData> | null>;
|
|
12
14
|
export declare const RenderQueueProvider: FC<{
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "Groß-/Kleinschreibung beachten",
|
|
10
10
|
"searchWholeWordsLabel": "Ganze Wörter",
|
|
11
11
|
"searchWholeWordsTooltip": "Exakte Wörter suchen (Groß-/Kleinschreibung ignorieren)",
|
|
12
|
+
"searchLoadingMessage": "Suche läuft",
|
|
13
|
+
"searchNoResultsMessage": "Keine Treffer gefunden",
|
|
14
|
+
"searchResultsMessage": "{current} von {total} Treffern",
|
|
12
15
|
"previousPageTooltip": "Vorherige Seite",
|
|
13
16
|
"currentPageTooltip": "Aktuelle Seite",
|
|
14
17
|
"nextPageTooltip": "Nächste Seite",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "Search case sensitive text",
|
|
10
10
|
"searchWholeWordsLabel": "Whole Words",
|
|
11
11
|
"searchWholeWordsTooltip": "Search exact and case insensitive word(s)",
|
|
12
|
+
"searchLoadingMessage": "Searching",
|
|
13
|
+
"searchNoResultsMessage": "No matches found",
|
|
14
|
+
"searchResultsMessage": "{current} of {total} matches",
|
|
12
15
|
"previousPageTooltip": "Previous page",
|
|
13
16
|
"currentPageTooltip": "Current page",
|
|
14
17
|
"nextPageTooltip": "Next page",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "Cerca testo con distinzione maiuscole/minuscole",
|
|
10
10
|
"searchWholeWordsLabel": "Parola intera",
|
|
11
11
|
"searchWholeWordsTooltip": "Cerca esatte parole senza distinzione maiuscole/minuscole",
|
|
12
|
+
"searchLoadingMessage": "Ricerca in corso",
|
|
13
|
+
"searchNoResultsMessage": "Nessuna corrispondenza trovata",
|
|
14
|
+
"searchResultsMessage": "{current} di {total} corrispondenze",
|
|
12
15
|
"previousPageTooltip": "Pagina precedente",
|
|
13
16
|
"currentPageTooltip": "Pagina corrente",
|
|
14
17
|
"nextPageTooltip": "Pagina successiva",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "Pesquisar texto com distinção de maiúsculas/minúsculas",
|
|
10
10
|
"searchWholeWordsLabel": "Palavra inteira",
|
|
11
11
|
"searchWholeWordsTooltip": "Pesquisar palavras exatas sem distinção de maiúsculas/minúsculas",
|
|
12
|
+
"searchLoadingMessage": "A pesquisar",
|
|
13
|
+
"searchNoResultsMessage": "Nenhuma correspondência encontrada",
|
|
14
|
+
"searchResultsMessage": "{current} de {total} correspondências",
|
|
12
15
|
"previousPageTooltip": "Página anterior",
|
|
13
16
|
"currentPageTooltip": "Página atual",
|
|
14
17
|
"nextPageTooltip": "Próxima página",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "ค้นหาข้อความที่มีการแยกตัวพิมพ์ใหญ่/พิมพ์เล็ก",
|
|
10
10
|
"searchWholeWordsLabel": "ทั้งคำ",
|
|
11
11
|
"searchWholeWordsTooltip": "ค้นหาคำที่ตรงตัวไม่มีการแยกตัวพิมพ์ใหญ่/พิมพ์เล็ก",
|
|
12
|
+
"searchLoadingMessage": "กำลังค้นหา",
|
|
13
|
+
"searchNoResultsMessage": "ไม่พบผลการค้นหา",
|
|
14
|
+
"searchResultsMessage": "ผลการค้นหาที่ {current} จาก {total}",
|
|
12
15
|
"previousPageTooltip": "หน้าก่อนหน้า",
|
|
13
16
|
"currentPageTooltip": "หน้าปัจจุบัน",
|
|
14
17
|
"nextPageTooltip": "หน้าถัดไป",
|
|
@@ -9,6 +9,9 @@ declare const _default: {
|
|
|
9
9
|
"searchMatchCaseTooltip": "搜索区分大小写",
|
|
10
10
|
"searchWholeWordsLabel": "全字匹配",
|
|
11
11
|
"searchWholeWordsTooltip": "搜索完全匹配",
|
|
12
|
+
"searchLoadingMessage": "正在搜索",
|
|
13
|
+
"searchNoResultsMessage": "未找到匹配项",
|
|
14
|
+
"searchResultsMessage": "第 {current} 条,共 {total} 条匹配",
|
|
12
15
|
"previousPageTooltip": "上一页",
|
|
13
16
|
"currentPageTooltip": "当前页",
|
|
14
17
|
"nextPageTooltip": "下一页",
|
|
@@ -10,6 +10,7 @@ export declare class Queue<T> {
|
|
|
10
10
|
enqueue(id: string, data: T, priority?: number): void;
|
|
11
11
|
dequeue(): QueueItem<T> | undefined;
|
|
12
12
|
removeQueue(id: string): boolean;
|
|
13
|
+
removeQueues(id: string | RegExp): number;
|
|
13
14
|
changePagePriority(id: string | RegExp, newPriority: number): boolean;
|
|
14
15
|
peekAll(): QueueItem<T>[];
|
|
15
16
|
isEmpty(): boolean;
|
|
@@ -3,3 +3,11 @@ export declare const THUMBNAIL_MIN_WIDTH = 200;
|
|
|
3
3
|
export declare const SCROLL_BAR_WIDTH = 20;
|
|
4
4
|
export declare const MIN_ZOOM_SCALE = 25;
|
|
5
5
|
export declare const MAX_ZOOM_SCALE = 1000;
|
|
6
|
+
export declare const ZOOM_STEP_PERCENT = 25;
|
|
7
|
+
export declare const ZOOM_DEBOUNCE_MS = 400;
|
|
8
|
+
export declare const ZOOM_SAFETY_TIMEOUT_MS = 1000;
|
|
9
|
+
export declare const MAX_CANVAS_DIM = 32767;
|
|
10
|
+
export declare const MAX_CANVAS_PIXELS = 33554432;
|
|
11
|
+
export declare const SAFARI_MAX_CANVAS_PIXELS = 16777216;
|
|
12
|
+
export declare const IOS_MAX_CANVAS_PIXELS = 5242880;
|
|
13
|
+
export declare const CANVAS_AREA_CAP_FACTOR = 200;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { ZoomOrigin } from './useZoomOrigin';
|
|
2
|
+
export type PinchZoomGesture = 'touch' | 'wheel';
|
|
3
|
+
export interface PinchZoomMetadata {
|
|
4
|
+
gesture?: PinchZoomGesture;
|
|
5
|
+
previousScale: number;
|
|
6
|
+
nextScale: number;
|
|
7
|
+
origin?: ZoomOrigin;
|
|
8
|
+
}
|
|
9
|
+
interface UsePinchOptions {
|
|
10
|
+
onBeforeZoom?: (metadata: PinchZoomMetadata) => void;
|
|
11
|
+
onPinchEnd?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const usePinch: (container: HTMLDivElement | null, options?: UsePinchOptions) => void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type ZoomOrigin = [number, number];
|
|
2
|
+
export declare const getZoomOriginFromClientPoint: (element: HTMLElement | null, clientX: number, clientY: number) => ZoomOrigin | null;
|
|
3
|
+
export declare const getZoomCenterOrigin: (element: HTMLElement | null) => ZoomOrigin | undefined;
|
|
4
|
+
export declare const useZoomOrigin: (element: HTMLElement | null) => () => ZoomOrigin | undefined;
|
|
@@ -86,6 +86,9 @@ export type Localization = {
|
|
|
86
86
|
searchMatchCaseTooltip?: string;
|
|
87
87
|
searchWholeWordsLabel?: string;
|
|
88
88
|
searchWholeWordsTooltip?: string;
|
|
89
|
+
searchLoadingMessage?: string;
|
|
90
|
+
searchNoResultsMessage?: string;
|
|
91
|
+
searchResultsMessage?: string;
|
|
89
92
|
previousPageTooltip?: string;
|
|
90
93
|
currentPageTooltip?: string;
|
|
91
94
|
nextPageTooltip?: string;
|
|
@@ -400,6 +403,7 @@ export declare enum ThemeVariables {
|
|
|
400
403
|
INPUT_BORDER_RADIUS = "--rp-input-border-radius",
|
|
401
404
|
INPUT_BACKGROUND_COLOR = "--rp-input-background-color",
|
|
402
405
|
INPUT_PLACEHOLDER_COLOR = "--rp-input-placeholder-color",
|
|
406
|
+
SEARCH_INPUT_BORDER_COLOR = "--rp-search-input-border-color",
|
|
403
407
|
PAGES_BACKGROUND_COLOR = "--rp-pages-background-color",
|
|
404
408
|
PAGE_SHADOW = "--rp-page-shadow",
|
|
405
409
|
PAGE_OUTLINE = "--rp-page-outline",
|
|
@@ -434,6 +438,7 @@ export declare enum ThemeVariables {
|
|
|
434
438
|
MENU_ITEM_ICON_SIZE = "--rp-menu-item-icon-size",
|
|
435
439
|
PRINT_PROGRESS_BACKGROUND = "--rp-print-progress-background",
|
|
436
440
|
PRINT_PROGRESS_COLOR = "--rp-print-progress-color",
|
|
441
|
+
PRINT_PROGRESS_CANCEL_BUTTON_BORDER_COLOR = "--rp-print-progress-cancel-button-border-color",
|
|
437
442
|
DROP_ZONE_BORDER = "--rp-drop-zone-border",
|
|
438
443
|
DROP_ZONE_FONT_COLOR = "--rp-drop-zone-font-color",
|
|
439
444
|
DROP_ZONE_FONT_SIZE = "--rp-drop-zone-font-size",
|
|
@@ -550,9 +555,20 @@ export interface DimensionPagesContextType {
|
|
|
550
555
|
export interface ZoomContextType {
|
|
551
556
|
zoomLevel: number | ZoomLevel;
|
|
552
557
|
currentZoom: number;
|
|
558
|
+
targetZoom: number;
|
|
559
|
+
isZooming: boolean;
|
|
560
|
+
zoomOrigin: [number, number] | null;
|
|
561
|
+
zoomGesture: 'touch' | 'wheel' | 'toolbar' | null;
|
|
562
|
+
previousTargetZoom: number | null;
|
|
563
|
+
zoomTo: (zoomLevel: number | ZoomLevel, options?: {
|
|
564
|
+
immediate?: boolean;
|
|
565
|
+
origin?: [number, number];
|
|
566
|
+
gesture?: 'touch' | 'wheel' | 'toolbar';
|
|
567
|
+
previousTargetZoom?: number;
|
|
568
|
+
}) => void;
|
|
553
569
|
setZoomLevel: (callback: number | ZoomLevel | ((prev: number) => number | ZoomLevel)) => void;
|
|
554
570
|
}
|
|
555
|
-
export type ZoomProps =
|
|
571
|
+
export type ZoomProps = Pick<ZoomContextType, 'zoomLevel' | 'setZoomLevel'>;
|
|
556
572
|
export type InitialStateContextType = {
|
|
557
573
|
interactiveForm?: boolean;
|
|
558
574
|
} & ZoomProviderProps & PageProviderProps & ViewModeInitialProps & ScrollModeInitialProps & RotateProviderProps;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare const isZoomOutDisabled: (currentZoom: number) => boolean;
|
|
2
2
|
export declare const isZoomInDisabled: (currentZoom: number) => boolean;
|
|
3
|
+
export declare const getNextZoomInLevel: (currentZoomPercent: number) => number;
|
|
4
|
+
export declare const getNextZoomOutLevel: (currentZoomPercent: number) => number;
|
package/dist/utils/Queue.js
CHANGED
|
@@ -6,6 +6,7 @@ var e = class {
|
|
|
6
6
|
this._triggerEnqueue = e;
|
|
7
7
|
}
|
|
8
8
|
enqueue(e, t, n = 0) {
|
|
9
|
+
this.removeQueue(e);
|
|
9
10
|
let r = {
|
|
10
11
|
id: e,
|
|
11
12
|
data: t,
|
|
@@ -20,6 +21,10 @@ var e = class {
|
|
|
20
21
|
let t = this._items.findIndex((t) => t.id === e);
|
|
21
22
|
return t === -1 ? !1 : (this._items.splice(t, 1), !0);
|
|
22
23
|
}
|
|
24
|
+
removeQueues(e) {
|
|
25
|
+
let t = new RegExp(e), n = this._items.length;
|
|
26
|
+
return this._items = this._items.filter((e) => !t.test(e.id)), n - this._items.length;
|
|
27
|
+
}
|
|
23
28
|
changePagePriority(e, t) {
|
|
24
29
|
let n = this._items.find((t) => new RegExp(e).test(t.id));
|
|
25
30
|
return n ? (this.removeQueue(n.id), this.enqueue(n.id, n.data, t), !0) : !1;
|
package/dist/utils/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region lib/utils/constants.ts
|
|
2
|
-
var e = 4, t = 200, n = 20, r = 25, i = 1e3;
|
|
2
|
+
var e = 4, t = 200, n = 20, r = 25, i = 1e3, a = 25, o = 400, s = 1e3, c = 32767, l = 33554432, u = 16777216, d = 5242880, f = 200;
|
|
3
3
|
//#endregion
|
|
4
|
-
export { i as MAX_ZOOM_SCALE, r as MIN_ZOOM_SCALE, e as PAGE_PADDING, n as SCROLL_BAR_WIDTH, t as THUMBNAIL_MIN_WIDTH };
|
|
4
|
+
export { f as CANVAS_AREA_CAP_FACTOR, d as IOS_MAX_CANVAS_PIXELS, c as MAX_CANVAS_DIM, l as MAX_CANVAS_PIXELS, i as MAX_ZOOM_SCALE, r as MIN_ZOOM_SCALE, e as PAGE_PADDING, u as SAFARI_MAX_CANVAS_PIXELS, n as SCROLL_BAR_WIDTH, t as THUMBNAIL_MIN_WIDTH, o as ZOOM_DEBOUNCE_MS, s as ZOOM_SAFETY_TIMEOUT_MS, a as ZOOM_STEP_PERCENT };
|
|
@@ -3,7 +3,7 @@ import { LicenseType as t } from "../types.js";
|
|
|
3
3
|
import { appConsole as n } from "../appConsole.js";
|
|
4
4
|
import { useCallback as r, useEffect as i, useState as a } from "react";
|
|
5
5
|
//#region lib/utils/hooks/useLicense.ts
|
|
6
|
-
var o = /* @__PURE__ */ new Date("2026-
|
|
6
|
+
var o = /* @__PURE__ */ new Date("2026-07-10T06:52:37.170Z"), s = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx\ngr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b\nHLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y\nBm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W\nvXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD\nvzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR\nkwIDAQAB\n-----END PUBLIC KEY-----", c = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", l = {
|
|
7
7
|
invalidLicense: `You are currently using without a valid license. ${c}`,
|
|
8
8
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${c}`,
|
|
9
9
|
expired: `Your license key has expired. ${c}`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "../../de_DE-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "../../de_DE-C1OrwQKj.js";
|
|
2
2
|
import { useCallback as o, useMemo as s, useState as c } from "react";
|
|
3
3
|
//#region lib/utils/hooks/useLocalization.ts
|
|
4
4
|
var l = (l) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e } from "../../PaginationContext-
|
|
1
|
+
import { i as e } from "../../PaginationContext-B3qzCYJu.js";
|
|
2
2
|
export { e as usePaginate };
|
|
@@ -1,66 +1,112 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_ZOOM_SCALE as e } from "../constants.js";
|
|
2
2
|
import { useZoomContext as t } from "../../contexts/ZoomContext.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getZoomOriginFromClientPoint as n } from "./useZoomOrigin.js";
|
|
4
|
+
import { useCallback as r, useEffect as i, useRef as a } from "react";
|
|
4
5
|
//#region lib/utils/hooks/usePinch.ts
|
|
5
|
-
var o = (
|
|
6
|
-
let {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
var o = () => 35 / (window.devicePixelRatio || 1), s = (s, c = {}) => {
|
|
7
|
+
let { targetZoom: l, zoomTo: u } = t(), { onBeforeZoom: d, onPinchEnd: f } = c, p = a(null), m = a(!1), h = a(1), g = a(1), _ = a(!1), v = a(!1), y = a(), b = a(l), x = a(null);
|
|
8
|
+
i(() => {
|
|
9
|
+
b.current = l;
|
|
10
|
+
}, [l]);
|
|
11
|
+
let S = r((e, t, n) => {
|
|
12
|
+
if (t === 1) return 1;
|
|
13
|
+
let r = n.current;
|
|
14
|
+
(r > 1 && t < 1 || r < 1 && t > 1) && (n.current = 1);
|
|
15
|
+
let i = Math.floor(e * t * n.current * 100) / (100 * e);
|
|
16
|
+
return n.current = t / i, i;
|
|
17
|
+
}, []), C = r((t, n, r) => {
|
|
18
|
+
let i = b.current || 1, a = 25 / 100, o = e / 100;
|
|
19
|
+
if (i >= o && t > 1 || i <= a && t < 1) return;
|
|
20
|
+
let s = Math.max(a, Math.min(o, Math.round(i * t * 100) / 100));
|
|
21
|
+
Math.abs(s - i) < 1e-10 || (d?.({
|
|
22
|
+
gesture: r,
|
|
23
|
+
previousScale: i,
|
|
24
|
+
nextScale: s,
|
|
25
|
+
origin: n
|
|
26
|
+
}), b.current = s, u(s * 100, {
|
|
27
|
+
origin: n,
|
|
28
|
+
gesture: r,
|
|
29
|
+
previousTargetZoom: i
|
|
30
|
+
}));
|
|
31
|
+
}, [d, u]), w = r((e, t) => n(s, e, t) ?? void 0, [s]), T = r(() => {
|
|
32
|
+
v.current || (_.current = !0, clearTimeout(y.current), y.current = setTimeout(() => {
|
|
33
|
+
_.current = !1;
|
|
34
|
+
}, 100));
|
|
35
|
+
}, []), E = r((e) => {
|
|
36
|
+
if (!e.ctrlKey) {
|
|
37
|
+
v.current = !1;
|
|
38
|
+
return;
|
|
15
39
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
if (v.current = !0, e.preventDefault(), _.current) return;
|
|
41
|
+
let t = Math.exp(-e.deltaY / 100);
|
|
42
|
+
C(S(b.current || 1, t, g), w(e.clientX, e.clientY), "wheel");
|
|
43
|
+
}, [
|
|
44
|
+
S,
|
|
45
|
+
w,
|
|
46
|
+
C
|
|
47
|
+
]), D = (e) => Array.from(e.touches).sort((e, t) => e.identifier - t.identifier), O = r(() => {
|
|
48
|
+
!s || x.current || (x.current = {
|
|
49
|
+
touchAction: s.style.touchAction,
|
|
50
|
+
webkitUserSelect: s.style.webkitUserSelect,
|
|
51
|
+
overscrollBehavior: s.style.overscrollBehavior,
|
|
52
|
+
webkitOverflowScrolling: s.style.getPropertyValue("-webkit-overflow-scrolling")
|
|
53
|
+
}, s.style.touchAction = "none", s.style.webkitUserSelect = "none", s.style.overscrollBehavior = "contain", s.style.setProperty("-webkit-overflow-scrolling", "auto"));
|
|
54
|
+
}, [s]), k = r(() => {
|
|
55
|
+
!s || !x.current || (s.style.touchAction = x.current.touchAction, s.style.webkitUserSelect = x.current.webkitUserSelect, s.style.overscrollBehavior = x.current.overscrollBehavior, x.current.webkitOverflowScrolling ? s.style.setProperty("-webkit-overflow-scrolling", x.current.webkitOverflowScrolling) : s.style.removeProperty("-webkit-overflow-scrolling"), x.current = null);
|
|
56
|
+
}, [s]), A = r(() => {
|
|
57
|
+
p.current = null, m.current = !1, h.current = 1, k(), f?.();
|
|
58
|
+
}, [f, k]), j = r((e) => {
|
|
59
|
+
if (e.touches.length !== 2) {
|
|
60
|
+
A();
|
|
34
61
|
return;
|
|
35
62
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (!
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
O(), e.preventDefault(), e.stopPropagation();
|
|
64
|
+
let [t, n] = D(e);
|
|
65
|
+
p.current = {
|
|
66
|
+
touch0ScreenX: t.screenX,
|
|
67
|
+
touch0ScreenY: t.screenY,
|
|
68
|
+
touch1ScreenX: n.screenX,
|
|
69
|
+
touch1ScreenY: n.screenY
|
|
70
|
+
}, m.current = !1;
|
|
71
|
+
}, [O, A]), M = r((e) => {
|
|
72
|
+
let t = p.current;
|
|
73
|
+
if (!t || e.touches.length !== 2) {
|
|
74
|
+
A();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
e.preventDefault(), e.stopPropagation();
|
|
78
|
+
let [n, r] = D(e), i = t.touch1ScreenX - t.touch0ScreenX, a = t.touch1ScreenY - t.touch0ScreenY, s = r.screenX - n.screenX, c = r.screenY - n.screenY, l = Math.hypot(i, a) || 1, u = Math.hypot(s, c) || 1;
|
|
79
|
+
if (!m.current && Math.abs(l - u) <= o()) return;
|
|
80
|
+
if (t.touch0ScreenX = n.screenX, t.touch0ScreenY = n.screenY, t.touch1ScreenX = r.screenX, t.touch1ScreenY = r.screenY, !m.current) {
|
|
81
|
+
m.current = !0;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
let d = u / l;
|
|
85
|
+
C(S(b.current || 1, d, h), w((n.clientX + r.clientX) / 2, (n.clientY + r.clientY) / 2), "touch");
|
|
86
|
+
}, [
|
|
87
|
+
S,
|
|
88
|
+
w,
|
|
89
|
+
A,
|
|
90
|
+
C
|
|
91
|
+
]), N = r((e) => {
|
|
92
|
+
e.touches.length >= 2 || (A(), g.current = 1);
|
|
93
|
+
}, [A]), P = r(() => {
|
|
94
|
+
A(), g.current = 1;
|
|
95
|
+
}, [A]);
|
|
96
|
+
i(() => {
|
|
97
|
+
if (s) return s.addEventListener("wheel", E, { passive: !1 }), s.addEventListener("scroll", T, { passive: !0 }), s.addEventListener("touchstart", j, { passive: !1 }), s.addEventListener("touchmove", M, { passive: !1 }), s.addEventListener("touchend", N, { passive: !1 }), s.addEventListener("touchcancel", P, { passive: !1 }), () => {
|
|
98
|
+
k(), s.removeEventListener("wheel", E), s.removeEventListener("scroll", T), s.removeEventListener("touchstart", j), s.removeEventListener("touchmove", M), s.removeEventListener("touchend", N), s.removeEventListener("touchcancel", P), clearTimeout(y.current);
|
|
56
99
|
};
|
|
57
100
|
}, [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
101
|
+
s,
|
|
102
|
+
T,
|
|
103
|
+
P,
|
|
104
|
+
N,
|
|
105
|
+
M,
|
|
106
|
+
j,
|
|
107
|
+
E,
|
|
108
|
+
k
|
|
63
109
|
]);
|
|
64
110
|
};
|
|
65
111
|
//#endregion
|
|
66
|
-
export {
|
|
112
|
+
export { s as usePinch };
|
|
@@ -4,19 +4,19 @@ import { useDebounce as n } from "./useDebounce.js";
|
|
|
4
4
|
import { useDimensionPagesContext as r } from "../../contexts/DimensionPagesContext.js";
|
|
5
5
|
import { useSmoothScrollContext as i } from "../../contexts/SmoothScrollContext.js";
|
|
6
6
|
import { getGridDimension as a, getPositionFromPage as o } from "../calculatePage.js";
|
|
7
|
-
import { r as s } from "../../PaginationContext-
|
|
7
|
+
import { r as s } from "../../PaginationContext-B3qzCYJu.js";
|
|
8
8
|
import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
9
9
|
//#region lib/utils/hooks/usePresentPage.ts
|
|
10
10
|
var p = (p, m, h, g) => {
|
|
11
|
-
let _ = d(), { contentRef:
|
|
12
|
-
|
|
13
|
-
let [
|
|
11
|
+
let _ = d(), v = d(), { contentRef: y } = t(), { heights: b, widths: x } = r(), { setFocusedPage: S } = s(), C = d(S);
|
|
12
|
+
C.current = S;
|
|
13
|
+
let [w, T] = f([]), { targetScrollPage: E } = i(), D = n(w, 0, 500), O = u(() => {
|
|
14
14
|
let t = g === e.DUAL_PAGE_WITH_COVER, { rowsHeight: n, columnsWidth: r } = a({
|
|
15
|
-
heights:
|
|
16
|
-
widths:
|
|
15
|
+
heights: b,
|
|
16
|
+
widths: x
|
|
17
17
|
}, p, t);
|
|
18
|
-
return
|
|
19
|
-
let a =
|
|
18
|
+
return b.map((e, i) => {
|
|
19
|
+
let a = x[i], s = o(i + 1, p, t), c = r.slice(0, s.columnIndex).reduce((e, t) => e + t, 0), l = n.slice(0, s.rowIndex).reduce((e, t) => e + t, 0), u = c + a, d = l + e;
|
|
20
20
|
return {
|
|
21
21
|
pageNumber: i + 1,
|
|
22
22
|
...s,
|
|
@@ -29,18 +29,22 @@ var p = (p, m, h, g) => {
|
|
|
29
29
|
};
|
|
30
30
|
});
|
|
31
31
|
}, [
|
|
32
|
-
y,
|
|
33
32
|
b,
|
|
33
|
+
x,
|
|
34
34
|
p,
|
|
35
35
|
m,
|
|
36
36
|
g
|
|
37
37
|
]);
|
|
38
38
|
l(() => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
D.length > 0 && !E.current && C.current(D[0].pageNumber);
|
|
40
|
+
let e = D[0]?.ratio, t = E.current;
|
|
41
|
+
e && D.some((e) => e.pageNumber === t) && (clearTimeout(v.current), v.current = setTimeout(() => {
|
|
42
|
+
E.current === t && (E.current = void 0);
|
|
43
|
+
}, 500));
|
|
44
|
+
}, [D]), l(() => () => {
|
|
45
|
+
clearTimeout(v.current);
|
|
46
|
+
}, []);
|
|
47
|
+
let k = c((e) => {
|
|
44
48
|
_.current && cancelAnimationFrame(_.current), _.current = requestAnimationFrame(() => {
|
|
45
49
|
let t = e.target, n = {
|
|
46
50
|
startTop: t.scrollTop,
|
|
@@ -48,7 +52,7 @@ var p = (p, m, h, g) => {
|
|
|
48
52
|
endTop: t.scrollTop + t.clientHeight,
|
|
49
53
|
endLeft: t.scrollLeft + t.clientWidth
|
|
50
54
|
};
|
|
51
|
-
|
|
55
|
+
T(O.filter((e) => {
|
|
52
56
|
let t = e.endX >= n.startLeft && e.endY >= n.startTop, r = e.startX <= n.endLeft && e.startY <= n.endTop;
|
|
53
57
|
return t && r;
|
|
54
58
|
}).map((e) => {
|
|
@@ -59,12 +63,12 @@ var p = (p, m, h, g) => {
|
|
|
59
63
|
};
|
|
60
64
|
}).sort((e, t) => t.ratio - e.ratio));
|
|
61
65
|
});
|
|
62
|
-
}, [
|
|
66
|
+
}, [y, O]);
|
|
63
67
|
l(() => {
|
|
64
|
-
if (h) return h?.addEventListener("scroll",
|
|
65
|
-
h?.removeEventListener("scroll",
|
|
68
|
+
if (h) return h?.addEventListener("scroll", k), () => {
|
|
69
|
+
h?.removeEventListener("scroll", k);
|
|
66
70
|
};
|
|
67
|
-
}, [h,
|
|
71
|
+
}, [h, k]);
|
|
68
72
|
};
|
|
69
73
|
//#endregion
|
|
70
74
|
export { p as usePresentPage };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e } from "../../PaginationContext-
|
|
1
|
+
import { a as e } from "../../PaginationContext-B3qzCYJu.js";
|
|
2
2
|
export { e as useScrollToPage };
|
|
@@ -9,7 +9,7 @@ import { usePagesRotateContext as c } from "../../contexts/PagesRotateContext.js
|
|
|
9
9
|
import { useDimensionPagesContext as l } from "../../contexts/DimensionPagesContext.js";
|
|
10
10
|
import { useSmoothScrollContext as u } from "../../contexts/SmoothScrollContext.js";
|
|
11
11
|
import { getScrollDistance as d } from "../getScrollDistance.js";
|
|
12
|
-
import { r as f } from "../../PaginationContext-
|
|
12
|
+
import { r as f } from "../../PaginationContext-B3qzCYJu.js";
|
|
13
13
|
import { findMatches as p } from "../highlight.js";
|
|
14
14
|
import { getWordPositionInPage as m } from "../getWordPositionInPage.js";
|
|
15
15
|
import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n } from "react";
|
|
2
|
+
//#region lib/utils/hooks/useZoomOrigin.ts
|
|
3
|
+
var r = (e, t, n) => Math.max(t, Math.min(e, n)), i = (e) => Number.isFinite(e.left) && Number.isFinite(e.top) && Number.isFinite(e.width) && Number.isFinite(e.height) && e.width > 0 && e.height > 0, a = (e, t, n) => {
|
|
4
|
+
if (!e || !Number.isFinite(t) || !Number.isFinite(n)) return null;
|
|
5
|
+
let a = e.getBoundingClientRect();
|
|
6
|
+
return i(a) ? [r(t - a.left, 0, a.width), r(n - a.top, 0, a.height)] : null;
|
|
7
|
+
}, o = (e) => {
|
|
8
|
+
if (!e) return;
|
|
9
|
+
let t = e.getBoundingClientRect();
|
|
10
|
+
if (!i(t)) return;
|
|
11
|
+
let { width: n, height: r } = t;
|
|
12
|
+
return [n / 2, r / 2];
|
|
13
|
+
}, s = (s) => {
|
|
14
|
+
let c = n(null), l = e((e, t) => a(s, e, t), [s]);
|
|
15
|
+
return t(() => {
|
|
16
|
+
if (!s) {
|
|
17
|
+
c.current = null;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let e = (e) => {
|
|
21
|
+
c.current = l(e.clientX, e.clientY);
|
|
22
|
+
}, t = (e) => {
|
|
23
|
+
c.current = l(e.clientX, e.clientY);
|
|
24
|
+
};
|
|
25
|
+
return s.addEventListener("pointermove", e, { passive: !0 }), s.addEventListener("mousemove", t, { passive: !0 }), () => {
|
|
26
|
+
s.removeEventListener("pointermove", e), s.removeEventListener("mousemove", t);
|
|
27
|
+
};
|
|
28
|
+
}, [s, l]), e(() => {
|
|
29
|
+
if (!s) return;
|
|
30
|
+
let e = s.getBoundingClientRect();
|
|
31
|
+
if (!i(e)) return;
|
|
32
|
+
let { width: t, height: n } = e, a = c.current;
|
|
33
|
+
return a ? [r(a[0], 0, t), r(a[1], 0, n)] : o(s);
|
|
34
|
+
}, [s]);
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { o as getZoomCenterOrigin, a as getZoomOriginFromClientPoint, s as useZoomOrigin };
|
package/dist/utils/renderPage.js
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IOS_MAX_CANVAS_PIXELS as e, MAX_CANVAS_DIM as t, MAX_CANVAS_PIXELS as n, SAFARI_MAX_CANVAS_PIXELS as r } from "./constants.js";
|
|
2
|
+
import { AnnotationMode as i } from "pdfjs-dist";
|
|
2
3
|
//#region lib/utils/renderPage.ts
|
|
3
|
-
var
|
|
4
|
-
let
|
|
5
|
-
|
|
4
|
+
var a = () => {
|
|
5
|
+
let t = navigator.userAgent, i = /iPad|iPhone|iPod/.test(t) && !window.MSStream, a = /^((?!chrome|android).)*safari/i.test(t);
|
|
6
|
+
return i ? e : a ? r : n;
|
|
7
|
+
}, o = (e, n) => {
|
|
8
|
+
let r = window.devicePixelRatio || 1, i = Math.max(e * n, 1), o = Math.min(a(), i * 200), s = Math.sqrt(o / i), c = t / Math.max(e, 1), l = t / Math.max(n, 1), u = Math.min(r, s, c, l);
|
|
9
|
+
return Number.isFinite(u) && u > 0 ? u : 1;
|
|
10
|
+
}, s = (e, t, n = {}) => {
|
|
11
|
+
let { scale: r = 1, rotate: a = 0, renderForms: s = !1, interactiveForm: c = !0 } = n, l = t.getContext("2d", { desynchronized: !1 }), u = e.getViewport({
|
|
12
|
+
scale: r,
|
|
6
13
|
rotation: a
|
|
7
|
-
}), d =
|
|
8
|
-
scale:
|
|
14
|
+
}), d = o(u.width, u.height), f = e.getViewport({
|
|
15
|
+
scale: r * d,
|
|
9
16
|
rotation: a
|
|
10
17
|
});
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
return
|
|
14
|
-
canvas:
|
|
15
|
-
canvasContext:
|
|
16
|
-
viewport:
|
|
17
|
-
annotationMode:
|
|
18
|
+
t.width = Math.floor(f.width), t.height = Math.floor(f.height), t.style.width = `${Math.floor(u.width)}px`, t.style.height = `${Math.floor(u.height)}px`;
|
|
19
|
+
let p = s ? i.ENABLE_FORMS : void 0;
|
|
20
|
+
return c || (p = i.ENABLE), e.render({
|
|
21
|
+
canvas: t,
|
|
22
|
+
canvasContext: l,
|
|
23
|
+
viewport: f,
|
|
24
|
+
annotationMode: p
|
|
18
25
|
});
|
|
19
26
|
};
|
|
20
27
|
//#endregion
|
|
21
|
-
export {
|
|
28
|
+
export { s as renderPage };
|