From 0653677ae9fb28916b9671c710e5b1d49ee1be5a Mon Sep 17 00:00:00 2001 From: bob Date: Wed, 20 Feb 2019 17:37:33 -0500 Subject: cleanup --- .../views/collections/CollectionSchemaView.tsx | 38 ++++++++-------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx index 0c7577421..e5727f5ac 100644 --- a/src/client/views/collections/CollectionSchemaView.tsx +++ b/src/client/views/collections/CollectionSchemaView.tsx @@ -14,7 +14,6 @@ import { DocumentView } from "../nodes/DocumentView"; import { FieldView, FieldViewProps } from "../nodes/FieldView"; import "./CollectionSchemaView.scss"; import { CollectionViewBase, COLLECTION_BORDER_WIDTH } from "./CollectionViewBase"; -import { Z_DEFAULT_COMPRESSION } from "zlib"; @observer export class CollectionSchemaView extends CollectionViewBase { @@ -22,6 +21,8 @@ export class CollectionSchemaView extends CollectionViewBase { private _mainCont = React.createRef(); + private DIVIDER_WIDTH = 5; + @observable selectedIndex = 0; @@ -117,14 +118,6 @@ export class CollectionSchemaView extends CollectionViewBase { } } - innerScreenToLocal(tx: number, ty: number) { - var zoom = this.props.Document.GetNumber(KeyStore.Scale, 1); - var xf = this.props.ScreenToLocalTransform().transform(new Transform(- 5 - COLLECTION_BORDER_WIDTH, - COLLECTION_BORDER_WIDTH, 1)).translate(-tx, -ty); - var center = [0, 0]; - var sabout = new Transform(center[0] / zoom, center[1] / zoom, 1).scaled(1 / this._parentScaling).translated(-center[0] / zoom, -center[1] / zoom); - var total = xf.transformed(sabout); - return () => total - } @computed get scale(): number { return this.props.Document.GetNumber(KeyStore.Scale, 1); @@ -137,7 +130,7 @@ export class CollectionSchemaView extends CollectionViewBase { } getTransform = (): Transform => { - return this.props.ScreenToLocalTransform().translate(- COLLECTION_BORDER_WIDTH - this._dividerX - 5, - COLLECTION_BORDER_WIDTH).transform(this.getLocalTransform()) + return this.props.ScreenToLocalTransform().translate(- COLLECTION_BORDER_WIDTH - this._dividerX - this.DIVIDER_WIDTH, - COLLECTION_BORDER_WIDTH).transform(this.getLocalTransform()) } getLocalTransform = (): Transform => { @@ -147,13 +140,11 @@ export class CollectionSchemaView extends CollectionViewBase { @action setScaling = (r: any) => { - var me = this; const children = this.props.Document.GetList(this.props.fieldKey, []); const selected = children.length > this.selectedIndex ? children[this.selectedIndex] : undefined; this._panelWidth = r.entry.width; - if (r.entry.height) - this._panelHeight = r.entry.height; - me._parentScaling = r.entry.width / selected!.GetNumber(KeyStore.NativeWidth, r.entry.width); + this._panelHeight = r.entry.height ? r.entry.height : this._panelHeight; + this._parentScaling = r.entry.width / selected!.GetNumber(KeyStore.NativeWidth, r.entry.width); } @observable _parentScaling = 1; // used to transfer the dimensions of the content pane in the DOM to the ParentScaling prop of the DocumentView @@ -171,7 +162,7 @@ export class CollectionSchemaView extends CollectionViewBase {
{ - return ( - { - Header: col.Name, - accessor: (doc: Document) => [doc, col], - id: col.Id - }) - })} + columns={columns.map(col => ({ + Header: col.Name, + accessor: (doc: Document) => [doc, col], + id: col.Id + }))} column={{ ...ReactTableDefaults.column, Cell: this.renderCell @@ -210,8 +198,8 @@ export class CollectionSchemaView extends CollectionViewBase {
} -
-
+
+
{content}
-- cgit v1.2.3-70-g09d2