aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/PDFViewer.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-12-13 20:49:48 -0500
committerbobzel <zzzman@gmail.com>2020-12-13 20:49:48 -0500
commitf9f0d6ca06e850e0ea68d7b7b701de46d9449169 (patch)
treeae7c6eeb2f4ad37c1ef0b5235952d9da6ece308e /src/client/views/pdf/PDFViewer.tsx
parent9af7025b7c9e6181843594f5179166556041234c (diff)
trying to fix PDFs for fitWidth and otherwise in ContentFitting and CollectionFreeFormDoc containers.
Diffstat (limited to 'src/client/views/pdf/PDFViewer.tsx')
-rw-r--r--src/client/views/pdf/PDFViewer.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index 7696167a7..be64754af 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -60,7 +60,7 @@ interface IViewerProps extends FieldViewProps {
loaded?: (nw: number, nh: number, np: number) => void;
isChildActive: (outsideReaction?: boolean) => boolean;
setPdfViewer: (view: PDFViewer) => void;
- ContentScaling: () => number;
+ ContentScaling?: () => number;
}
/**
@@ -371,7 +371,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
@action
scrollToAnnotation = (scrollToAnnotation: Doc) => {
if (scrollToAnnotation) {
- const offset = (this.props.PanelHeight() / this.props.ContentScaling()) / 2;
+ const offset = (this.props.PanelHeight() / this.contentScaling) / 2;
this._mainCont.current && smoothScroll(500, this._mainCont.current, NumCast(scrollToAnnotation.y) - offset);
Doc.linkFollowHighlight(scrollToAnnotation);
}
@@ -738,7 +738,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
@computed get pdfViewerDiv() {
return <div className={"pdfViewerDash-text" + ((this.props.isSelected() || this.props.isChildActive()) ? "-selected" : "")} ref={this._viewer} />;
}
- @computed get contentScaling() { return this.props.ContentScaling(); }
+ @computed get contentScaling() { return this.props.ContentScaling?.() || 1; }
@computed get standinViews() {
return <>
{this._showCover ? this.getCoverImage() : (null)}
@@ -759,7 +759,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
overflowX: this._zoomed !== 1 ? "scroll" : undefined,
width: !this.props.Document._fitWidth && (window.screen.width > 600) ? Doc.NativeWidth(this.props.Document) : `${100 / this.contentScaling}%`,
height: !this.props.Document._fitWidth && (window.screen.width > 600) ? Doc.NativeHeight(this.props.Document) : `${100 / this.contentScaling}%`,
- transform: `scale(${this.props.ContentScaling()})`
+ transform: `scale(${this.contentScaling})`
}} >
{this.pdfViewerDiv}
{this.annotationLayer}