aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/PDFBox.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-06-14 15:53:13 -0400
committerbob <bcz@cs.brown.edu>2019-06-14 15:53:13 -0400
commit15e8341334419142f4a54db23cc643f18ba0e0f1 (patch)
treec89e80096b86d61a66e3d01f5232f7acabb643a8 /src/client/views/nodes/PDFBox.tsx
parent0b4f3c25471e51d27ddb33dc5ddafafb2c0c03e5 (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.tsx5
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;