aboutsummaryrefslogtreecommitdiff
path: root/src/views/nodes/ImageBox.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-02-05 19:37:48 -0500
committerTyler Schicke <tyler_schicke@brown.edu>2019-02-05 19:37:48 -0500
commit6a13071a695732b2235f988278c52d0072af0fb5 (patch)
tree94d6ccf16572463520fd744e41988b1dc8c7b7e3 /src/views/nodes/ImageBox.tsx
parent41afca0448b4e75459fc8aeb53192f6a44aa2b18 (diff)
parent6e66f8b227c730e07863a93a8bce5ee0d51d2ddc (diff)
Merge branch 'master' of github-tsch-brown:browngraphicslab/Dash-Web into scripting
Diffstat (limited to 'src/views/nodes/ImageBox.tsx')
-rw-r--r--src/views/nodes/ImageBox.tsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/views/nodes/ImageBox.tsx b/src/views/nodes/ImageBox.tsx
index 5137dbf38..dd201f20f 100644
--- a/src/views/nodes/ImageBox.tsx
+++ b/src/views/nodes/ImageBox.tsx
@@ -5,7 +5,8 @@ import { SelectionManager } from "../../util/SelectionManager";
import "./ImageBox.scss";
import React = require("react")
import { ImageField } from '../../fields/ImageField';
-import { FieldViewProps } from './FieldView';
+import { FieldViewProps, FieldView } from './FieldView';
+import { CollectionFreeFormDocumentView } from './CollectionFreeFormDocumentView';
interface ImageBoxState {
photoIndex: number,
@@ -14,7 +15,7 @@ interface ImageBoxState {
export class ImageBox extends React.Component<FieldViewProps, ImageBoxState> {
- public static LayoutString() { return "<ImageBox doc={Document} documentViewContainer={ContainingDocumentView} fieldKey={DataKey} />"; }
+ public static LayoutString() { return FieldView.LayoutString("ImageBox"); }
private _ref: React.RefObject<HTMLDivElement>;
private _downX: number = 0;
private _downY: number = 0;
@@ -38,7 +39,7 @@ export class ImageBox extends React.Component<FieldViewProps, ImageBoxState> {
onPointerDown = (e: React.PointerEvent): void => {
if (Date.now() - this._lastTap < 300) {
- if (e.buttons === 1 && SelectionManager.IsSelected(this.props.documentViewContainer)) {
+ if (e.buttons === 1 && this.props.DocumentViewForField instanceof CollectionFreeFormDocumentView && SelectionManager.IsSelected(this.props.DocumentViewForField)) {
e.stopPropagation();
this._downX = e.clientX;
this._downY = e.clientY;
@@ -66,7 +67,7 @@ export class ImageBox extends React.Component<FieldViewProps, ImageBoxState> {
const images = [path,];
var lightbox = () => {
const { photoIndex } = this.state;
- if (this.state.isOpen && SelectionManager.IsSelected(this.props.documentViewContainer)) {
+ if (this.state.isOpen && this.props.DocumentViewForField instanceof CollectionFreeFormDocumentView && SelectionManager.IsSelected(this.props.DocumentViewForField)) {
return (<Lightbox
mainSrc={images[photoIndex]}
nextSrc={photoIndex + 1 < images.length ? images[(photoIndex + 1) % images.length] : undefined}