diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2020-06-12 07:56:27 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2020-06-12 07:56:27 -0400 |
commit | 8e2b01cc8f302d509ce0234abbe36c5d9637ab38 (patch) | |
tree | 254e62765a92edca4f835c80ade501a3babf7506 /src | |
parent | 4632a7544aa337d8ebecfd560fe5faee702d7806 (diff) |
fixed errors in gridview caused by restructuring.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/collectionGrid/CollectionGridView.tsx | 34 | ||||
-rw-r--r-- | src/client/views/collections/collectionGrid/Grid.tsx | 1 |
2 files changed, 20 insertions, 15 deletions
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; })} > - <input className="rowHeightSlider" type="range" - style={{ width: this.props.PanelHeight() - 30 }} - min={1} value={this.rowHeight} max={this.props.PanelHeight() - 30} - onPointerDown={this.onSliderDown} onChange={this.onSliderChange} /> <Grid width={this.props.PanelWidth()} nodeList={this.contents.length ? this.contents : null} @@ -305,6 +307,10 @@ export class CollectionGridView extends CollectionSubView(GridSchema) { preventCollision={BoolCast(this.props.Document.gridPreventCollision)}// determines whether nodes should move out of the way (i.e. collide) when other nodes are dragged over them margin={this.margin} /> + <input className="rowHeightSlider" type="range" + style={{ width: this.props.PanelHeight() - 30 }} + min={1} value={this.rowHeight} max={this.props.PanelHeight() - 30} + onPointerDown={this.onSliderDown} onChange={this.onSliderChange} /> </div> </div > ); 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<GridProps> { 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} |