aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ImageBox.tsx
diff options
context:
space:
mode:
authorGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-10-20 18:21:12 +0800
committerGeireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>2020-10-20 18:21:12 +0800
commit47549789d3b9d21fea2e1159441810f2ddb8c2ab (patch)
tree1f958cf9580e7f10b00c8194a68a9e09e3279be8 /src/client/views/nodes/ImageBox.tsx
parent65940c176cca651bf4bfface9be5d86d49c881c6 (diff)
parent48e907bdf5424f53c03f60bd93122135e7c1cb92 (diff)
Merge branch 'presentation_v1' of https://github.com/browngraphicslab/Dash-Web into presentation_v1
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r--src/client/views/nodes/ImageBox.tsx13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index bc38a17eb..88dc3b241 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -76,14 +76,11 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps, ImageD
componentDidMount() {
this._pathDisposer = reaction(() => ({ nativeSize: this.nativeSize, width: this.layoutDoc[WidthSym]() }),
- ({ nativeSize, width }) => {
- if (this.props.NativeWidth?.() !== 0 || !this.layoutDoc._height) {
- this.layoutDoc._nativeWidth = nativeSize.nativeWidth;
- this.layoutDoc._nativeHeight = nativeSize.nativeHeight;
- this.layoutDoc._nativeOrientation = nativeSize.nativeOrientation;
+ action(({ nativeSize, width }) => {
+ if (!this.layoutDoc._height) {
this.layoutDoc._height = width * nativeSize.nativeHeight / nativeSize.nativeWidth;
}
- },
+ }),
{ fireImmediately: true });
}
@@ -106,8 +103,8 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps, ImageD
const targetDoc = layoutDoc[DataSym];
if (targetDoc[targetField] instanceof ImageField) {
this.dataDoc[this.fieldKey] = ObjectField.MakeCopy(targetDoc[targetField] as ImageField);
- this.dataDoc[this.fieldKey + "-nativeWidth"] = NumCast(targetDoc[targetField + "-nativeWidth"]);
- this.dataDoc[this.fieldKey + "-nativeHeight"] = NumCast(targetDoc[targetField + "-nativeHeight"]);
+ Doc.SetNativeWidth(this.dataDoc, Doc.NativeWidth(targetDoc));
+ Doc.SetNativeWidth(this.dataDoc, Doc.NativeHeight(targetDoc));
e.stopPropagation();
}
}