diff options
author | bob <bcz@cs.brown.edu> | 2019-06-14 15:53:13 -0400 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-06-14 15:53:13 -0400 |
commit | 15e8341334419142f4a54db23cc643f18ba0e0f1 (patch) | |
tree | c89e80096b86d61a66e3d01f5232f7acabb643a8 /src/client/views/nodes/PDFBox.tsx | |
parent | 0b4f3c25471e51d27ddb33dc5ddafafb2c0c03e5 (diff) |
a few tweaks to fix unfreezing documents to give them a margin
Diffstat (limited to 'src/client/views/nodes/PDFBox.tsx')
-rw-r--r-- | src/client/views/nodes/PDFBox.tsx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index cce7b2631..899caa68a 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -33,9 +33,12 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen loaded = (nw: number, nh: number) => { if (this.props.Document) { + if (this.props.Document.nativeWidth && this.props.Document.nativeHeight) return; let doc = this.props.Document.proto ? this.props.Document.proto : this.props.Document; + let oldaspect = NumCast(doc.nativeHeight) / NumCast(doc.nativeWidth, 1); doc.nativeWidth = nw; - doc.nativeHeight = nh; + if (doc.nativeHeight) doc.nativeHeight = nw * oldaspect; + else doc.nativeHeight = nh; let ccv = this.props.ContainingCollectionView; if (ccv) { ccv.props.Document.pdfHeight = nh; |