aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/PDFViewer.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-12-13 14:25:33 -0500
committerbobzel <zzzman@gmail.com>2020-12-13 14:25:33 -0500
commit898227ac1cecb3cd8d4be4ed00ab4190713f006a (patch)
tree4cd165cad87ea55c7022a06f2230d69b8770c7d0 /src/client/views/pdf/PDFViewer.tsx
parent043fe3cb67003ddd0bc309b85e2b0dad353ed629 (diff)
adding documentView as a fieldView prop to make contetnScaling available in PDFview
Diffstat (limited to 'src/client/views/pdf/PDFViewer.tsx')
-rw-r--r--src/client/views/pdf/PDFViewer.tsx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index fc547c60f..7696167a7 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -60,6 +60,7 @@ interface IViewerProps extends FieldViewProps {
loaded?: (nw: number, nh: number, np: number) => void;
isChildActive: (outsideReaction?: boolean) => boolean;
setPdfViewer: (view: PDFViewer) => void;
+ ContentScaling: () => number;
}
/**
@@ -370,7 +371,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
@action
scrollToAnnotation = (scrollToAnnotation: Doc) => {
if (scrollToAnnotation) {
- const offset = this.props.PanelHeight() / 2;
+ const offset = (this.props.PanelHeight() / this.props.ContentScaling()) / 2;
this._mainCont.current && smoothScroll(500, this._mainCont.current, NumCast(scrollToAnnotation.y) - offset);
Doc.linkFollowHighlight(scrollToAnnotation);
}
@@ -737,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 1; }
+ @computed get contentScaling() { return this.props.ContentScaling(); }
@computed get standinViews() {
return <>
{this._showCover ? this.getCoverImage() : (null)}
@@ -758,6 +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()})`
}} >
{this.pdfViewerDiv}
{this.annotationLayer}