aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ImageBox.tsx
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-12-07 19:32:59 -0500
committerSam Wilkins <samwilkins333@gmail.com>2019-12-07 19:32:59 -0500
commit30b112009af6de99fa84ff29d3b92f648b0900df (patch)
tree6b426a4be37cd3c98c34eb3ef2dd6eca921aa080 /src/client/views/nodes/ImageBox.tsx
parent304d7f239ae6e7b854a8da1124a919b7ba093b48 (diff)
parentd3492a9a8dd221cf0828f1011c718353278ce87b (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r--src/client/views/nodes/ImageBox.tsx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index f60888929..4b3da3dae 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -215,6 +215,7 @@ export class ImageBox extends DocAnnotatableComponent<FieldViewProps, ImageDocum
}
_curSuffix = "_m";
+ _resized = false;
resize = (srcpath: string) => {
requestImageSize(srcpath)
.then((size: any) => {
@@ -223,11 +224,12 @@ export class ImageBox extends DocAnnotatableComponent<FieldViewProps, ImageDocum
const aspect = realsize.height / realsize.width;
if (this.Document.width && (Math.abs(1 - NumCast(this.Document.height) / NumCast(this.Document.width) / (realsize.height / realsize.width)) > 0.1)) {
setTimeout(action(() => {
+ this._resized = true;
this.Document.height = this.Document[WidthSym]() * aspect;
this.Document.nativeHeight = realsize.height;
this.Document.nativeWidth = realsize.width;
}), 0);
- }
+ } else this._resized = true;
})
.catch((err: any) => console.log(err));
}
@@ -315,7 +317,7 @@ export class ImageBox extends DocAnnotatableComponent<FieldViewProps, ImageDocum
const srcaspect = paths[Math.min(paths.length - 1, (this.Document.curPage || 0))][1] as number;
const fadepath = paths[Math.min(paths.length - 1, 1)][0] as string;
- !this.Document.ignoreAspect && this.resize(srcpath);
+ !this.Document.ignoreAspect && !this._resized && this.resize(srcpath);
return <div className="imageBox-cont" key={this.props.Document[Id]} ref={this.createDropTarget} onContextMenu={this.specificContextMenu}>
<div className="imageBox-fader" >