diff options
| author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-09-22 15:29:28 -0400 |
|---|---|---|
| committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-09-22 15:29:28 -0400 |
| commit | d8a43b76f101a2f38ef1e3e9cbf8ec036468481d (patch) | |
| tree | 08fea673e890c1e3b5c22d7a58d6c06c45fdc1fe /src/client/views/collections/collectionSchema/CollectionSchemaView.tsx | |
| parent | 24c6c3f0c9b43059cd013d344dfa065969f73389 (diff) | |
header comments + change to cellfield updating
Diffstat (limited to 'src/client/views/collections/collectionSchema/CollectionSchemaView.tsx')
| -rw-r--r-- | src/client/views/collections/collectionSchema/CollectionSchemaView.tsx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 0e5a1e6b6..11a4e88f9 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -495,6 +495,26 @@ export class CollectionSchemaView extends CollectionSubView() { return adjIndex; }; + @action + setRelCursorIndex = (mouseY: number) => { + this._mouseCoordinates.y = mouseY; // updates this.rowDropIndex computed value to overwrite the old cached value + + const rowHeight = CollectionSchemaView._rowHeight; + const adjInitMouseY = mouseY - rowHeight - 100; // rowHeight: height of the column menu cells | 100: height of the top menu + const yOffset = this._lowestSelectedIndex * rowHeight; + + const heights = this._selectedDocs.map(() => this.rowHeightFunc()); + let index: number = 0; + heights.reduce((total, curr, i) => { + if (total <= adjInitMouseY && total + curr >= adjInitMouseY) { + if (adjInitMouseY <= total + curr) index = i; + else index = i + 1; + } + return total + curr; + }, yOffset); + this._relCursorIndex = index; + }; + highlightDraggedColumn = (index: number) => this._colEles.forEach((colRef, i) => { const edgeStyle = i === index ? `solid 2px ${Colors.MEDIUM_BLUE}` : ''; @@ -731,7 +751,7 @@ export class CollectionSchemaView extends CollectionSubView() { const field = this.columnKeys[col]; const refToAdd = `d${docIndex}.${field}` const editedField = this._referenceSelectMode.currEditing ? this._referenceSelectMode.currEditing as SchemaCellField : null; - editedField?.appendText(refToAdd, true); + editedField?.insertText(refToAdd, true); editedField?.setupRefSelect(false); return; } |
