diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-03-01 22:17:50 -0500 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-03-01 22:17:50 -0500 |
commit | 13a5b32b04e65c154aeb12190e761d8174b858e9 (patch) | |
tree | 8727edb1291c7c7be4d2eed9c07fd936dcd2db85 /src | |
parent | 98ade639c6ffa6cc704cc310af506973d83e494b (diff) |
some fixes
Diffstat (limited to 'src')
4 files changed, 14 insertions, 14 deletions
diff --git a/src/client/views/DocumentManager.tsx b/src/client/views/DocumentManager.tsx index 750b7aecf..a53ed4a91 100644 --- a/src/client/views/DocumentManager.tsx +++ b/src/client/views/DocumentManager.tsx @@ -198,7 +198,7 @@ export class DocumentManager { // } @action - public centerNode(doc: Document | DocumentView, x: number, y: number): any { + public centerNode(doc: Document | DocumentView, collection: Document): void { //console.log(doc.Title) //gets document view that is in freeform collection let docView: DocumentView | null; @@ -218,13 +218,15 @@ export class DocumentManager { if (docView) { let { width, height } = docView.size(); - let scale = docView.props.Document.GetNumber(KeyStore.Scale, 1) - let doc = docView.props.Document + let scale = docView.props.Document.GetNumber(KeyStore.Scale, 1); + let doc = docView.props.Document; + let x = doc.GetNumber(KeyStore.X, 0); + let y = doc.GetNumber(KeyStore.X, 0); if (x && y) { XView = (-x * scale) - (width * scale / 2); YView = (-y * scale) - (height * scale / 2); - DocumentManager.Instance.setViewportXY(docView, XView, YView) + DocumentManager.Instance.setViewportXY(collection, XView, YView) } } @@ -274,10 +276,8 @@ export class DocumentManager { @action - private setViewportXY(collection: DocumentView, x: number, y: number) { - console.log("setting") - let doc = collection.props.Document; - doc.SetNumber(KeyStore.PanX, x); - doc.SetNumber(KeyStore.PanY, y); + private setViewportXY(collection: Document, x: number, y: number) { + collection.SetNumber(KeyStore.PanX, x); + collection.SetNumber(KeyStore.PanY, y); } }
\ No newline at end of file diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx index fe2fc42ad..5cb97696d 100644 --- a/src/client/views/collections/CollectionFreeFormView.tsx +++ b/src/client/views/collections/CollectionFreeFormView.tsx @@ -193,11 +193,11 @@ export class CollectionFreeFormView extends CollectionViewBase { PanelWidth={doc.Width} PanelHeight={doc.Height} ContainingCollectionView={this.props.CollectionView} - focus={(doc: Document, x: number, y: number) => { + focus={(doc: Document) => { //set pan of colleciton freeform and then call parent console.log("calling...") - DocumentManager.Instance.centerNode(doc, doc.GetNumber(KeyStore.X, 0), doc.GetNumber(KeyStore.Y, 0)) - this.props.focus(this.props.Document, doc.GetNumber(KeyStore.X, 0), doc.GetNumber(KeyStore.Y, 0)) + DocumentManager.Instance.centerNode(doc, this.props.Document) + this.props.focus(this.props.Document) }} />); }) diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx index 4eaf585ce..4a4abbea9 100644 --- a/src/client/views/collections/CollectionSchemaView.tsx +++ b/src/client/views/collections/CollectionSchemaView.tsx @@ -212,7 +212,7 @@ export class CollectionSchemaView extends CollectionViewBase { PanelWidth={this.getPanelWidth} PanelHeight={this.getPanelHeight} ContainingCollectionView={this.props.CollectionView} - focus={(doc, x, y) => this.props.focus(this.props.Document, x, y)} + focus={(doc) => this.props.focus(this.props.Document)} /> </div> } diff --git a/src/client/views/collections/CollectionViewBase.tsx b/src/client/views/collections/CollectionViewBase.tsx index d9e43c0dc..1fff3a470 100644 --- a/src/client/views/collections/CollectionViewBase.tsx +++ b/src/client/views/collections/CollectionViewBase.tsx @@ -23,7 +23,7 @@ export interface CollectionViewProps { bindings: any; panelWidth: () => number; panelHeight: () => number; - focus: (doc: Document, x: number, y: number) => void; + focus: (doc: Document) => void; } export interface SubCollectionViewProps extends CollectionViewProps { active: () => boolean; |