From f2bdae28c9fcd5306b0d14e1bbfafc2bb232aed8 Mon Sep 17 00:00:00 2001 From: Monika Hedman Date: Tue, 19 Feb 2019 19:01:28 -0500 Subject: got width and height!!! --- src/client/views/nodes/DocumentView.tsx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src/client/views/nodes') 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 { 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 { } //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 { 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); -- cgit v1.2.3-70-g09d2