Skip to content

Commit

Permalink
Fix scale factor not set dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed May 8, 2023
1 parent ab5ecd8 commit 118afaf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/Document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,14 @@ const Document = forwardRef(function Document(
}

return (
<div className={clsx('react-pdf__Document', className)} ref={inputRef} {...eventProps}>
<div
className={clsx('react-pdf__Document', className)}
ref={inputRef}
style={{
['--scale-factor' as string]: '1',
}}
{...eventProps}
>
{renderContent()}
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ export default function Page(props: PageProps) {
data-page-number={pageNumber}
ref={mergeRefs(inputRef, pageElement)}
style={{
['--scale-factor' as string]: `${scale}`,
position: 'relative',
minWidth: 'min-content',
minHeight: 'min-content',
Expand Down
1 change: 0 additions & 1 deletion src/Page/AnnotationLayer.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
left: 0;
pointer-events: none;
transform-origin: 0 0;
--scale-factor: 1;
}

.annotationLayer section {
Expand Down
1 change: 0 additions & 1 deletion src/Page/TextLayer.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
forced-color-adjust: none;
transform-origin: 0 0;
z-index: 2;
--scale-factor: 1;
}

.textLayer span,
Expand Down

0 comments on commit 118afaf

Please sign in to comment.