aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ImageBox.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2020-01-23 18:43:53 -0500
committerbob <bcz@cs.brown.edu>2020-01-23 18:43:53 -0500
commit846e1c7eba28f042509ec84c31afe2bcbb5a2283 (patch)
treedb437ee134566925173456d19aeb2b1a6fbaf61b /src/client/views/nodes/ImageBox.tsx
parentc23d9ba83c87511a626bfe8d1da5dd981e311262 (diff)
imagebox fixes
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r--src/client/views/nodes/ImageBox.tsx12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index 1a07c1598..7b06d323f 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -214,7 +214,7 @@ export class ImageBox extends DocAnnotatableComponent<FieldViewProps, ImageDocum
_resized = "";
resize = (imgPath: string) => {
- if (!this.dataDoc[this.props.fieldKey + "-nativeHeight"])
+ if (!this.dataDoc[this.props.fieldKey + "-nativeHeight"]) {
requestImageSize(imgPath)
.then((size: any) => {
const rotation = NumCast(this.dataDoc[this.props.fieldKey + "-rotation"]) % 180;
@@ -225,13 +225,19 @@ export class ImageBox extends DocAnnotatableComponent<FieldViewProps, ImageDocum
if (this.paths[NumCast(this.props.Document.curPage)] === imgPath && (!this.layoutDoc.isTemplateDoc || this.dataDoc !== this.layoutDoc)) {
this._resized = imgPath;
this.Document._height = this.Document[WidthSym]() * aspect;
- this.dataDoc[this.props.fieldKey + "-nativeHeight"] = this.dataDoc._nativeHeight = realsize.height;
- this.dataDoc[this.props.fieldKey + "-nativeWidth"] = this.dataDoc._nativeWidth = realsize.width;
+ this.dataDoc[this.props.fieldKey + "-nativeHeight"] = this.Document._nativeHeight = realsize.height;
+ this.dataDoc[this.props.fieldKey + "-nativeWidth"] = this.Document._nativeWidth = realsize.width;
}
}), 0);
} else this._resized = imgPath;
})
.catch((err: any) => console.log(err));
+ } else {
+ setTimeout(() => {
+ this.Document._nativeHeight = NumCast(this.dataDoc[this.props.fieldKey + "-nativeHeight"]);
+ this.Document._nativeWidth = NumCast(this.dataDoc[this.props.fieldKey + "-nativeWidth"]);
+ }, 0);
+ }
}
@action