aboutsummaryrefslogtreecommitdiff
path: root/src/views/nodes
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-02-01 14:50:11 -0500
committerbob <bcz@cs.brown.edu>2019-02-01 14:50:11 -0500
commit156245bbca2082a8b8cf426a381ed25d1be57bcb (patch)
treedb9646b31b216e1bee17fcb0d1c81e95cefdac2e /src/views/nodes
parent588e1edf046aea0f280117f4aaa5b9853258c05b (diff)
stopped dragging of topmost documents.
Diffstat (limited to 'src/views/nodes')
-rw-r--r--src/views/nodes/DocumentView.tsx11
-rw-r--r--src/views/nodes/ImageBox.tsx11
2 files changed, 11 insertions, 11 deletions
diff --git a/src/views/nodes/DocumentView.tsx b/src/views/nodes/DocumentView.tsx
index 560cc0ee0..ae5712182 100644
--- a/src/views/nodes/DocumentView.tsx
+++ b/src/views/nodes/DocumentView.tsx
@@ -172,6 +172,11 @@ export class DocumentView extends React.Component<DocumentViewProps> {
return SelectionManager.IsSelected(this) || this.props.ContainingCollectionView === undefined || this.props.ContainingCollectionView!.active;
}
+ @computed
+ get topMost(): boolean {
+ return this.props.ContainingCollectionView == undefined || this.props.ContainingCollectionView instanceof CollectionDockingView;
+ }
+
//
// returns the cumulative scaling between the document and the screen
@@ -281,7 +286,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
}
if (Math.abs(this._downX - e.clientX) > 3 || Math.abs(this._downY - e.clientY) > 3) {
this._contextMenuCanOpen = false;
- if (this._mainCont.current != null && this.props.ContainingCollectionView != null) {
+ if (this._mainCont.current != null && !this.topMost) {
this._contextMenuCanOpen = false;
const rect = this.screenRect;
let dragData: { [id: string]: any } = {};
@@ -340,9 +345,7 @@ export class DocumentView extends React.Component<DocumentViewProps> {
return;
}
- var topMost = this.props.ContainingCollectionView == undefined ||
- this.props.ContainingCollectionView instanceof CollectionDockingView;
- if (topMost) {
+ if (this.topMost) {
ContextMenu.Instance.clearItems()
ContextMenu.Instance.addItem({ description: "Full Screen", event: this.fullScreenClicked })
ContextMenu.Instance.displayMenu(e.pageX - 15, e.pageY - 15)
diff --git a/src/views/nodes/ImageBox.tsx b/src/views/nodes/ImageBox.tsx
index ffdcbae05..1dfad462f 100644
--- a/src/views/nodes/ImageBox.tsx
+++ b/src/views/nodes/ImageBox.tsx
@@ -15,7 +15,9 @@ export class ImageBox extends React.Component<DocumentFieldViewProps, ImageBoxSt
public static LayoutString() { return "<ImageBox doc={Document} containingDocumentView={ContainingDocumentView} fieldKey={DataKey} />"; }
private _ref: React.RefObject<HTMLDivElement>;
- private _wasSelected: boolean = false;
+ private _downX: number = 0;
+ private _downY: number = 0;
+ private _lastTap: number = 0;
constructor(props: DocumentFieldViewProps) {
super(props);
@@ -33,14 +35,9 @@ export class ImageBox extends React.Component<DocumentFieldViewProps, ImageBoxSt
componentWillUnmount() {
}
- _downX: number = 0;
- _downY: number = 0;
- _singleTap = false;
- _lastTap: number = 0;
onPointerDown = (e: React.PointerEvent): void => {
- const { containingDocumentView } = this.props;
if (Date.now() - this._lastTap < 300) {
- if (e.buttons === 1 && SelectionManager.IsSelected(containingDocumentView)) {
+ if (e.buttons === 1 && SelectionManager.IsSelected(this.props.containingDocumentView)) {
e.stopPropagation();
this._downX = e.clientX;
this._downY = e.clientY;