aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-02-19 16:11:31 -0500
committerbob <bcz@cs.brown.edu>2019-02-19 16:11:31 -0500
commitb3c5cbe54eee7d234c2c3924ad018b95efd72243 (patch)
tree638d69ab4bf310620cbb41d45dad9bb70b042b07
parent02f36f30593ba05cd3af166c17d30a67c69590c9 (diff)
got rid of DocumentView as a prop
-rw-r--r--src/client/views/collections/CollectionViewBase.tsx10
-rw-r--r--src/client/views/nodes/DocumentView.tsx4
2 files changed, 3 insertions, 11 deletions
diff --git a/src/client/views/collections/CollectionViewBase.tsx b/src/client/views/collections/CollectionViewBase.tsx
index 0a90bd0f2..0acc890d8 100644
--- a/src/client/views/collections/CollectionViewBase.tsx
+++ b/src/client/views/collections/CollectionViewBase.tsx
@@ -1,22 +1,17 @@
import { action, computed } from "mobx";
import { observer } from "mobx-react";
import { Document } from "../../../fields/Document";
-import { Opt } from "../../../fields/Field";
import { Key } from "../../../fields/Key";
import { ListField } from "../../../fields/ListField";
import { SelectionManager } from "../../util/SelectionManager";
import { ContextMenu } from "../ContextMenu";
import React = require("react");
-import { DocumentView } from "../nodes/DocumentView";
-import { CollectionDockingView } from "./CollectionDockingView";
-import { CollectionFreeFormDocumentView } from "../nodes/CollectionFreeFormDocumentView";
import { Transform } from "../../util/Transform";
export interface CollectionViewProps {
fieldKey: Key;
Document: Document;
- ContainingDocumentView: Opt<DocumentView>;
ScreenToLocalTransform: () => Transform;
isSelected: () => boolean;
isTopMost: boolean;
@@ -32,12 +27,11 @@ export class CollectionViewBase extends React.Component<CollectionViewProps> {
public static LayoutString(collectionType: string, fieldKey: string = "DataKey") {
return `<${collectionType} Document={Document}
ScreenToLocalTransform={ScreenToLocalTransform} fieldKey={${fieldKey}} isSelected={isSelected} select={select}
- isTopMost={isTopMost}
- ContainingDocumentView={DocumentView} BackgroundView={BackgroundView} />`;
+ isTopMost={isTopMost} BackgroundView={BackgroundView} />`;
}
@computed
public get active(): boolean {
- var isSelected = (this.props.ContainingDocumentView && SelectionManager.IsSelected(this.props.ContainingDocumentView));
+ var isSelected = this.props.isSelected();
var childSelected = SelectionManager.SelectedDocuments().some(view => view.props.ContainingCollectionView == this);
var topMost = this.props.isTopMost;
return isSelected || childSelected || topMost;
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 0ef8856b7..ac1996ac5 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -278,13 +278,11 @@ export class DocumentView extends React.Component<DocumentViewProps> {
bindings.BackgroundView = backgroundView;
}
- bindings.DocumentView = this;
-
var width = this.props.Document.GetNumber(KeyStore.NativeWidth, 0);
var strwidth = width > 0 ? width.toString() + "px" : "100%";
var height = this.props.Document.GetNumber(KeyStore.NativeHeight, 0);
var strheight = height > 0 ? height.toString() + "px" : "100%";
- var scaling = this.props.Scaling;// this.props.ScreenToLocalTransform().Scale;
+ var scaling = this.props.Scaling;
return (
<div className="documentView-node" ref={this._mainCont} style={{ width: strwidth, height: strheight, transformOrigin: "left top", transform: `scale(${scaling},${scaling})` }}
onContextMenu={this.onContextMenu}