aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-06-14 15:47:43 -0400
committeryipstanley <stanley_yip@brown.edu>2019-06-14 15:47:43 -0400
commit2ef1dd2089ad991f1d4897022f2d28c2eb130837 (patch)
tree57add9cdf31cad56fa93987ab570e5ef3e91fc1d /src/client/views/nodes
parent4818b12510404e7d9cf07b7e872c49d7b752976a (diff)
highlighting
Diffstat (limited to 'src/client/views/nodes')
-rw-r--r--src/client/views/nodes/PDFBox.tsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx
index acb430deb..6ee62bbad 100644
--- a/src/client/views/nodes/PDFBox.tsx
+++ b/src/client/views/nodes/PDFBox.tsx
@@ -34,8 +34,16 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen
loaded = (nw: number, nh: number) => {
if (this.props.Document) {
let doc = this.props.Document.proto ? this.props.Document.proto : this.props.Document;
+ let oldnw = NumCast(doc.nativeWidth);
doc.nativeWidth = nw;
- doc.nativeHeight = nh;
+ if (!doc.nativeHeight) {
+ doc.nativeHeight = nh;
+ }
+ else {
+ let oldnh = NumCast(doc.nativeHeight);
+ let aspect = oldnh / oldnw;
+ doc.nativeHeight = nw * aspect;
+ }
let ccv = this.props.ContainingCollectionView;
if (ccv) {
ccv.props.Document.pdfHeight = nh;