diff options
author | Monika Hedman <monika_hedman@brown.edu> | 2019-02-19 19:01:28 -0500 |
---|---|---|
committer | Monika Hedman <monika_hedman@brown.edu> | 2019-02-19 19:01:28 -0500 |
commit | f2bdae28c9fcd5306b0d14e1bbfafc2bb232aed8 (patch) | |
tree | 8c4c3f21975329f9079aeb96b49a4db73fc40fa1 /src/client/views/nodes/DocumentView.tsx | |
parent | 0ac7f12d00273003b0d0ca87df7bf553fa2e93c0 (diff) |
got width and height!!!
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
-rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 9bd8c0288..8e2f1afe7 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1,4 +1,4 @@ -import { action, computed } from "mobx"; +import { action, computed, runInAction } from "mobx"; import { observer } from "mobx-react"; import { observable } from "mobx"; import { Document } from "../../../fields/Document"; @@ -179,11 +179,11 @@ export class DocumentView extends React.Component<DocumentViewProps> { ContextMenu.Instance.displayMenu(e.pageX - 15, e.pageY - 15) } + //TODO Monika @action Center = (e: React.MouseEvent): void => { DocumentManager.Instance.centerNode(this.props.Document) DocumentManager.Instance.centerNode(this) - //console.log(this.props.ContainingCollectionView.props.) } @action @@ -230,17 +230,23 @@ export class DocumentView extends React.Component<DocumentViewProps> { } //adds doc to global list + @action componentDidMount: () => void = () => { - DocumentManager.Instance.DocumentViews.push(this); + runInAction(() => { + DocumentManager.Instance.DocumentViews.push(this); + }) } //removes doc from global list + @action componentWillUnmount: () => void = () => { - for (let node of DocumentManager.Instance.DocumentViews) { - if (Object.is(node, this)) { - DocumentManager.Instance.DocumentViews.splice(DocumentManager.Instance.DocumentViews.indexOf(this), 1); + runInAction(() => { + for (let node of DocumentManager.Instance.DocumentViews) { + if (Object.is(node, this)) { + DocumentManager.Instance.DocumentViews.splice(DocumentManager.Instance.DocumentViews.indexOf(this), 1); + } } - } + }) } isSelected = () => { return SelectionManager.IsSelected(this); @@ -278,6 +284,8 @@ 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); |