aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-02-04 09:59:04 -0500
committerbob <bcz@cs.brown.edu>2019-02-04 09:59:04 -0500
commit6539a76c8fae1fa816bde4d9e094eb074d1a68b8 (patch)
tree55e7e431c24e08567fc3802b127012f24e292747 /src
parente6871754b90e2179a140c6f0c365b95be80e245b (diff)
let schema views handle events when active
Diffstat (limited to 'src')
-rw-r--r--src/views/collections/CollectionSchemaView.tsx18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/views/collections/CollectionSchemaView.tsx b/src/views/collections/CollectionSchemaView.tsx
index b95faeebe..dd33958dc 100644
--- a/src/views/collections/CollectionSchemaView.tsx
+++ b/src/views/collections/CollectionSchemaView.tsx
@@ -6,10 +6,11 @@ import { KeyStore as KS, Key } from "../../fields/Key";
import { Document } from "../../fields/Document";
import { FieldView } from "../nodes/FieldView";
import "react-table/react-table.css"
-import { observable, action } from "mobx";
+import { observable, action, computed } from "mobx";
import SplitPane from "react-split-pane"
import "./CollectionSchemaView.scss"
import { ScrollBox } from "../../util/ScrollBox";
+import { SelectionManager } from "../../util/SelectionManager";
@observer
export class CollectionSchemaView extends React.Component<CollectionViewProps> {
@@ -54,11 +55,26 @@ export class CollectionSchemaView extends React.Component<CollectionViewProps> {
};
}
+ @computed
+ public get active(): boolean {
+ var isSelected = (this.props.ContainingDocumentView != undefined && SelectionManager.IsSelected(this.props.ContainingDocumentView));
+ var childSelected = false; // SelectionManager.SelectedDocuments().some(view => view.props.ContainingCollectionView == this);
+ var topMost = this.props.ContainingDocumentView != undefined && this.props.ContainingDocumentView.props.ContainingCollectionView == undefined;
+ return isSelected || childSelected || topMost;
+ }
onPointerDown = (e: React.PointerEvent) => {
let target = e.target as HTMLElement;
if (target.tagName == "SPAN" && target.className.includes("Resizer")) {
e.stopPropagation();
}
+ if (e.button === 2 && this.active) {
+ e.stopPropagation();
+ e.preventDefault();
+ } else {
+ if (e.buttons === 1 && this.active) {
+ e.stopPropagation();
+ }
+ }
}
render() {