@anaralabs/lector 3.8.0 → 3.9.1
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/README.md +2 -0
- package/dist/index.js +6 -5
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1076,14 +1076,14 @@ var AnnotationLayer2 = ({
|
|
|
1076
1076
|
};
|
|
1077
1077
|
var useDpr = () => {
|
|
1078
1078
|
const [dpr, setDPR] = useState(
|
|
1079
|
-
|
|
1079
|
+
typeof window === "undefined" ? 1 : Math.min(window.devicePixelRatio, 2)
|
|
1080
1080
|
);
|
|
1081
1081
|
useEffect(() => {
|
|
1082
|
-
if (
|
|
1082
|
+
if (typeof window === "undefined") {
|
|
1083
1083
|
return;
|
|
1084
1084
|
}
|
|
1085
1085
|
const handleDPRChange = () => {
|
|
1086
|
-
setDPR(window.devicePixelRatio);
|
|
1086
|
+
setDPR(Math.min(window.devicePixelRatio, 2));
|
|
1087
1087
|
};
|
|
1088
1088
|
const windowMatch = window.matchMedia(
|
|
1089
1089
|
`screen and (min-resolution: ${dpr}dppx)`
|
|
@@ -2530,8 +2530,9 @@ var Page = ({
|
|
|
2530
2530
|
...props
|
|
2531
2531
|
}) => {
|
|
2532
2532
|
const pdfPageProxy = usePdf((state) => state.getPdfPageProxy(pageNumber));
|
|
2533
|
-
const
|
|
2534
|
-
const
|
|
2533
|
+
const viewport = usePdf((state) => state.viewports[pageNumber - 1]);
|
|
2534
|
+
const width = viewport?.width ?? (pdfPageProxy.view[2] ?? 0) - (pdfPageProxy.view[0] ?? 0);
|
|
2535
|
+
const height = viewport?.height ?? (pdfPageProxy.view[3] ?? 0) - (pdfPageProxy.view[1] ?? 0);
|
|
2535
2536
|
return /* @__PURE__ */ jsx(PDFPageNumberContext.Provider, { value: pdfPageProxy.pageNumber, children: /* @__PURE__ */ jsx(
|
|
2536
2537
|
Primitive.div,
|
|
2537
2538
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anaralabs/lector",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "Headless PDF viewer for React",
|
|
5
5
|
"author": "andrewdr (https://github.com/andrewdoro)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"repository": {
|
|
85
85
|
"type": "git",
|
|
86
86
|
"url": "git+https://github.com/anaralabs/lector.git",
|
|
87
|
-
"directory": "packages/
|
|
87
|
+
"directory": "packages/lector"
|
|
88
88
|
},
|
|
89
89
|
"bugs": {
|
|
90
90
|
"url": "https://github.com/anaralabs/lector/issues"
|