aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ImageBox.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-04-20 01:33:50 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-04-20 01:33:50 -0400
commit4bf22b6095cee078403e4ac11743e7aaa557956c (patch)
treea11b9db9df6165d92a51b1e74ed741c81d52e622 /src/client/views/nodes/ImageBox.tsx
parente3ad2c2c8f920a5538541b8e495af52815e36dc6 (diff)
parent425ea0bacbb40312c5f722f27bf0ca93fe0b17b3 (diff)
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web into newDocs
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r--src/client/views/nodes/ImageBox.tsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index 71b431b84..fd5381b77 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -38,7 +38,10 @@ export class ImageBox extends React.Component<FieldViewProps> {
onLoad = (target: any) => {
var h = this._imgRef.current!.naturalHeight;
var w = this._imgRef.current!.naturalWidth;
- if (this._photoIndex === 0) this.props.Document.SetNumber(KeyStore.NativeHeight, this.props.Document.GetNumber(KeyStore.NativeWidth, 0) * h / w);
+ if (this._photoIndex === 0) {
+ this.props.Document.SetNumber(KeyStore.NativeHeight, this.props.Document.GetNumber(KeyStore.NativeWidth, 0) * h / w);
+ this.props.Document.SetNumber(KeyStore.Height, this.props.Document.Width() * h / w);
+ }
}
@@ -65,7 +68,7 @@ export class ImageBox extends React.Component<FieldViewProps> {
if (layout.indexOf(ImageBox.name) !== -1) {
let imgData = this.props.Document.Get(KeyStore.Data);
if (imgData instanceof ImageField && imgData) {
- this.props.Document.Set(KeyStore.Data, new ListField([imgData]));
+ this.props.Document.SetOnPrototype(KeyStore.Data, new ListField([imgData]));
}
let imgList = this.props.Document.GetList(KeyStore.Data, [] as any[]);
if (imgList) {
@@ -137,6 +140,7 @@ export class ImageBox extends React.Component<FieldViewProps> {
@action
onDotDown(index: number) {
this._photoIndex = index;
+ this.props.Document.SetNumber(KeyStore.CurPage, index);
}
dots(paths: string[]) {