From 8e2b01cc8f302d509ce0234abbe36c5d9637ab38 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Fri, 12 Jun 2020 07:56:27 -0400 Subject: fixed errors in gridview caused by restructuring. --- .../collectionGrid/CollectionGridView.tsx | 34 +++++++++++++--------- .../views/collections/collectionGrid/Grid.tsx | 1 - 2 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionGrid/CollectionGridView.tsx b/src/client/views/collections/collectionGrid/CollectionGridView.tsx index 562ba7933..ec142f7a5 100644 --- a/src/client/views/collections/collectionGrid/CollectionGridView.tsx +++ b/src/client/views/collections/collectionGrid/CollectionGridView.tsx @@ -97,7 +97,8 @@ export class CollectionGridView extends CollectionSubView(GridSchema) { unflexedPosition(index: number) { return { x: (index % Math.floor(this.numCols / this.defaultW)) * this.defaultW, - y: Math.floor(index / Math.floor(this.numCols / this.defaultH)) * this.defaultH + y: Math.floor(index / Math.floor(this.numCols / this.defaultH)) * this.defaultH, + static: true }; } @@ -253,6 +254,7 @@ export class CollectionGridView extends CollectionSubView(GridSchema) { undoBatch(() => this.props.Document.gridRowHeight = this._rowHeight)(); this._rowHeight = undefined; }), emptyFunction, false, false); + e.stopPropagation(); } /** * Adds the display option to change the css display attribute of the `ContentFittingDocumentView`s @@ -265,15 +267,19 @@ export class CollectionGridView extends CollectionSubView(GridSchema) { } onPointerDown = (e: React.PointerEvent) => { - this.props.isSelected(true) && setupMoveUpEvents(this, e, returnFalse, returnFalse, action((e: PointerEvent, doubleTap?: boolean) => { - if (doubleTap) { - const text = Docs.Create.TextDocument("", { _width: 150, _height: 50 }); - FormattedTextBox.SelectOnLoad = text[Id];// track the new text box so we can give it a prop that tells it to focus itself when it's displayed - Doc.AddDocToList(this.props.Document, this.props.fieldKey, text); - this.setLayoutList(this.addLayoutItem(this.parsedLayoutList, this.makeLayoutItem(text, this.screenToCell(e.clientX, e.clientY)))); - } - }), false); - e.stopPropagation(); + if (this.props.isSelected(true)) { + setupMoveUpEvents(this, e, returnFalse, returnFalse, + action((e: PointerEvent, doubleTap?: boolean) => { + if (doubleTap) { + const text = Docs.Create.TextDocument("", { _width: 150, _height: 50 }); + FormattedTextBox.SelectOnLoad = text[Id];// track the new text box so we can give it a prop that tells it to focus itself when it's displayed + Doc.AddDocToList(this.props.Document, this.props.fieldKey, text); + this.setLayoutList(this.addLayoutItem(this.parsedLayoutList, this.makeLayoutItem(text, this.screenToCell(e.clientX, e.clientY)))); + } + }), + false); + e.stopPropagation(); + } } render() { @@ -288,10 +294,6 @@ export class CollectionGridView extends CollectionSubView(GridSchema) { if (!this.props.isSelected()) e.currentTarget.scrollTop = this._scroll; else this._scroll = e.currentTarget.scrollTop; })} > - + ); diff --git a/src/client/views/collections/collectionGrid/Grid.tsx b/src/client/views/collections/collectionGrid/Grid.tsx index 66edb99d9..3d2ed0cf9 100644 --- a/src/client/views/collections/collectionGrid/Grid.tsx +++ b/src/client/views/collections/collectionGrid/Grid.tsx @@ -44,7 +44,6 @@ export default class Grid extends React.Component { onLayoutChange={this.props.setLayout} preventCollision={this.props.preventCollision} transformScale={1 / this.props.transformScale} // still doesn't work :( - style={{ zIndex: 5 }} margin={[this.props.margin, this.props.margin]} > {this.props.nodeList} -- cgit v1.2.3-70-g09d2