diff options
| author | Bob Zeleznik <zzzman@gmail.com> | 2020-04-17 10:51:17 -0400 | 
|---|---|---|
| committer | Bob Zeleznik <zzzman@gmail.com> | 2020-04-17 10:51:17 -0400 | 
| commit | 0736662068dbeb02a8a9dda84bc0ac523650d8c6 (patch) | |
| tree | 4d7183b29beb83196cd27b9247ac734756b58e1a /src/client/views/nodes/ImageBox.tsx | |
| parent | ac40232e5bbbb98680912eb3c505bab994079074 (diff) | |
fixed native size of images with template on reloading
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
| -rw-r--r-- | src/client/views/nodes/ImageBox.tsx | 5 | 
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 4be9eef29..6bc7c8440 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -250,8 +250,8 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps, ImageD      resize = (imgPath: string) => {          const cachedNativeSize = { -            width: NumCast(this.dataDoc[this.fieldKey + "-nativeWidth"]), -            height: NumCast(this.dataDoc[this.fieldKey + "-nativeHeight"]) +            width: imgPath === this.dataDoc[this.fieldKey + "-path"] ? NumCast(this.dataDoc[this.fieldKey + "-nativeWidth"]) : 0, +            height: imgPath === this.dataDoc[this.fieldKey + "-path"] ? NumCast(this.dataDoc[this.fieldKey + "-nativeHeight"]) : 0,          };          const docAspect = this.layoutDoc[HeightSym]() / this.layoutDoc[WidthSym]();          const cachedAspect = cachedNativeSize.height / cachedNativeSize.width; @@ -265,6 +265,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps, ImageD                          this.layoutDoc._height = this.layoutDoc[WidthSym]() * rotatedAspect;                          this.dataDoc[this.fieldKey + "-nativeWidth"] = this.layoutDoc._nativeWidth = this.layoutDoc._width;                          this.dataDoc[this.fieldKey + "-nativeHeight"] = this.layoutDoc._nativeHeight = this.layoutDoc._height; +                        this.dataDoc[this.fieldKey + "-path"] = imgPath;                      }                  })).catch(console.log);              } else if (Math.abs(1 - docAspect / cachedAspect) > 0.1) {  | 
