diff options
author | Monika Hedman <monika_hedman@brown.edu> | 2019-02-18 18:52:30 -0500 |
---|---|---|
committer | Monika Hedman <monika_hedman@brown.edu> | 2019-02-18 18:52:30 -0500 |
commit | 30986620c34c93e12509b2875e90cf5876838403 (patch) | |
tree | 781a4324a98a3b2f25c05d59c04fb98f791d0573 | |
parent | d669634a8bffab2248cf1732babe3a516bc55e4c (diff) |
transforms
-rw-r--r-- | src/client/views/DocumentManager.tsx | 40 | ||||
-rw-r--r-- | src/client/views/Main.tsx | 8 | ||||
-rw-r--r-- | src/client/views/TempTreeView.tsx | 5 | ||||
-rw-r--r-- | src/client/views/collections/CollectionDockingView.tsx | 1 |
4 files changed, 35 insertions, 19 deletions
diff --git a/src/client/views/DocumentManager.tsx b/src/client/views/DocumentManager.tsx index 904ac0cce..4d8756107 100644 --- a/src/client/views/DocumentManager.tsx +++ b/src/client/views/DocumentManager.tsx @@ -93,11 +93,10 @@ export class DocumentManager { //if the view exists in a freeform collection if (docView != null) { //view.props.GetTransform().TranslateX - width = docView.props.Document.GetNumber(KeyStore.NativeWidth, 0) - height = docView.props.Document.GetNumber(KeyStore.NativeHeight, 0) + width = docView.props.Document.GetNumber(KeyStore.Width, 0) + height = docView.props.Document.GetNumber(KeyStore.Height, 0) - - //base case: parent does not exist (aka is parent) + //base case: parent of parent does not exist if (docView.props.ContainingCollectionView == null) { // scale = RootStore.Instance.MainNodeCollection.Scale; // XView = (-node.X * scale) + (window.innerWidth / 2) - (node.Width * scale / 2); @@ -106,22 +105,37 @@ export class DocumentManager { scale = docView.props.GetTransform().Scale XView = (-docView.props.GetTransform().TranslateX * scale) + (window.innerWidth / 2) - (width * scale / 2) YView = (-docView.props.GetTransform().TranslateY * scale) + (window.innerHeight / 2) - (height * scale / 2) + //set x and y view of parent } //parent is not main, parent is centered and calls itself else { + console.log("------------------------------------------") + console.log(docView.props.ContainingCollectionView.props.DocumentForCollection.Title) + console.log("------------------------------------------") console.log("parent does exist") - if (docView.props.ContainingCollectionView.props.BackgroundView != null) { + if (docView.props.ContainingCollectionView.props.DocumentForCollection != null) { console.log("view of parent exists") - let parentWidth = docView.props.ContainingCollectionView.props.BackgroundView.props.Document.GetNumber(KeyStore.NativeWidth, 0) - let parentHeight = docView.props.ContainingCollectionView.props.BackgroundView.props.Document.GetNumber(KeyStore.NativeHeight, 0) - scale = docView.props.ContainingCollectionView.props.BackgroundView.props.GetTransform().Scale - XView = (-docView.props.GetTransform().TranslateX * scale) + (parentWidth / 2) - (width * scale / 2); - YView = (-docView.props.GetTransform().TranslateY * scale) + (parentHeight / 2) - (height * scale / 2); - //node.Parent.setViewportXY(XView, YView); - this.setViewportXY(docView.props.ContainingCollectionView, XView, YView) + let tempView = this.getDocumentView(docView.props.ContainingCollectionView.props.DocumentForCollection) + + console.log(docView.props.ContainingCollectionView.props.DocumentForCollection.GetNumber(KeyStore.Width, 0)) + + let parentWidth = docView.props.ContainingCollectionView.props.DocumentForCollection.GetNumber(KeyStore.Width, 0) + let parentHeight = docView.props.ContainingCollectionView.props.DocumentForCollection.GetNumber(KeyStore.Height, 0) + + console.log("parent width: " + parentWidth + ", parent height: " + parentHeight) + + + if (tempView != null) { + console.log("View is NOT null") + scale = tempView.props.GetTransform().Scale + XView = (-docView.props.GetTransform().TranslateX * scale) + (parentWidth / 2) - (width * scale / 2); + YView = (-docView.props.GetTransform().TranslateY * scale) + (parentHeight / 2) - (height * scale / 2); + //node.Parent.setViewportXY(XView, YView); + this.setViewportXY(docView.props.ContainingCollectionView, XView, YView) - return this.centerNode(docView.props.ContainingCollectionView.props.BackgroundView.props.Document); + return this.centerNode(docView.props.ContainingCollectionView.props.DocumentForCollection); + } } } } diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx index 5d23f5439..38e353055 100644 --- a/src/client/views/Main.tsx +++ b/src/client/views/Main.tsx @@ -64,9 +64,9 @@ let doc4 = Documents.CollectionDocument(docset, { // x: 650, y: 500, width: 600, height: 600, title: "cat 2" // }); let docset2 = [doc3, doc1, doc2]; -let doc6 = Documents.CollectionDocument(docset2, { - x: 350, y: 100, width: 600, height: 600, title: "docking collection" -}); +// let doc6 = Documents.CollectionDocument(docset2, { +// x: 350, y: 100, width: 600, height: 600, title: "docking collection" +// }); let mainNodes = mainContainer.GetOrCreate<ListField<Document>>(KeyStore.Data, ListField); // mainNodes.Data.push(doc6); // mainNodes.Data.push(doc2); @@ -75,7 +75,7 @@ mainNodes.Data.push(doc3); // mainNodes.Data.push(doc5); // mainNodes.Data.push(doc1); // mainNodes.Data.push(doc2); -mainNodes.Data.push(doc6); +//mainNodes.Data.push(doc6); //} //); diff --git a/src/client/views/TempTreeView.tsx b/src/client/views/TempTreeView.tsx index 5bb44fde2..2d02f3fde 100644 --- a/src/client/views/TempTreeView.tsx +++ b/src/client/views/TempTreeView.tsx @@ -16,8 +16,9 @@ export class TempTreeView extends React.Component<IProps>{ onClick(doc: Document) { let view = DocumentManager.Instance.getDocumentView(doc); if (view != null) { - console.log(view.Id) - console.log(view.props.GetTransform().TranslateX) + //console.log(view.Id) + //console.log(view.props.GetTransform().TranslateX) + DocumentManager.Instance.centerNode(view); console.log(view.props.Document.Title) if (view.props.ContainingCollectionView != undefined) { diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx index c870a9cf0..310933275 100644 --- a/src/client/views/collections/CollectionDockingView.tsx +++ b/src/client/views/collections/CollectionDockingView.tsx @@ -229,6 +229,7 @@ export class CollectionDockingView extends CollectionViewBase { .off('click') //unbind the current click handler .click(function () { //if (confirm('really close this?')) { + console.log("closing!") stack.remove(); //} }); |