diff options
author | bob <bcz@cs.brown.edu> | 2019-02-11 17:37:03 -0500 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-02-11 17:37:03 -0500 |
commit | 9f8653ab3d7f82a5d82b925bf339bef8d6723f5c (patch) | |
tree | 2bfab025912bb9e14dc304302bf583915fcc871f /src/client/views/nodes/ImageBox.tsx | |
parent | 400a14c03c10f07f3e4cfedd1df963d9263e98c8 (diff) |
added framework for annotation overlays -- see ImageBox
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r-- | src/client/views/nodes/ImageBox.tsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index ab20f140c..b96e717ed 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -9,7 +9,8 @@ import { FieldViewProps, FieldView } from './FieldView'; import { CollectionFreeFormDocumentView } from './CollectionFreeFormDocumentView'; import { FieldWaiting } from '../../../fields/Field'; import { observer } from "mobx-react" -import { observable, action } from 'mobx'; +import { observable, action, spy } from 'mobx'; +import { KeyStore } from '../../../fields/Key'; @observer export class ImageBox extends React.Component<FieldViewProps> { @@ -67,7 +68,9 @@ export class ImageBox extends React.Component<FieldViewProps> { mainSrc={images[this._photoIndex]} nextSrc={images[(this._photoIndex + 1) % images.length]} prevSrc={images[(this._photoIndex + images.length - 1) % images.length]} - onCloseRequest={() => this.setState({ isOpen: false })} + onCloseRequest={action(() => + this._isOpen = false + )} onMovePrevRequest={action(() => this._photoIndex = (this._photoIndex + images.length - 1) % images.length )} @@ -82,10 +85,11 @@ export class ImageBox extends React.Component<FieldViewProps> { let field = this.props.doc.Get(this.props.fieldKey); let path = field == FieldWaiting ? "https://image.flaticon.com/icons/svg/66/66163.svg" : field instanceof ImageField ? field.Data.href : "http://www.cs.brown.edu/~bcz/face.gif"; + let width = this.props.doc.GetNumber(KeyStore.Width, 1); return ( <div className="imageBox-cont" onPointerDown={this.onPointerDown} ref={this._ref} > - <img src={path} width="100%" alt="Image not found" /> + <img src={path} width={width} alt="Image not found" /> {this.lightbox(path)} </div>) } |