diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/DragManager.ts | 1 | ||||
-rw-r--r-- | src/client/views/collections/collectionSchema/CollectionSchemaView.tsx | 10 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts index aa0f77c72..7d7baa25d 100644 --- a/src/client/util/DragManager.ts +++ b/src/client/util/DragManager.ts @@ -177,6 +177,7 @@ export namespace DragManager { constructor(colIndex: number) { this.colIndex = colIndex; } + colIndex: number; } // used by PDFs,Text,Image,Video,Web to conditionally (if the drop completes) create a text annotation when dragging the annotate button from the AnchorMenu when a text/region selection has been made. diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 1e8dbc937..e826a7f99 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -93,6 +93,7 @@ export class CollectionSchemaView extends CollectionSubView() { @observable _mouseCoordinates = { x: 0, y: 0 }; @observable _lowestSelectedIndex = -1; //lowest index among selected rows; used to properly sync dragged docs with cursor position @observable _relCursorIndex = -1; //cursor index relative to the current selected cells + @observable _draggedColIndex = 0; // target HTMLelement portal for showing a popup menu to edit cell values. public get MenuTarget() { @@ -381,6 +382,7 @@ export class CollectionSchemaView extends CollectionSubView() { @action dragColumn = (e: PointerEvent, index: number) => { + this._draggedColIndex = index; const dragData = new DragManager.ColumnDragData(index); const dragEles = [this._colEles[index]]; this.childDocs.forEach(doc => dragEles.push(this._rowEles.get(doc).children[1].children[index])); @@ -406,7 +408,6 @@ export class CollectionSchemaView extends CollectionSubView() { } return total + curr; }, CollectionSchemaView._rowMenuWidth); - console.log(index); return index; }; @@ -418,8 +419,8 @@ export class CollectionSchemaView extends CollectionSubView() { */ @action setRelCursorIndex = (mouseY: number) => { - this._mouseCoordinates.y = mouseY; - + this._mouseCoordinates.y = mouseY; //updates this.rowDropIndex computed value to overwrite the old cached value + let rowHeight = CollectionSchemaView._rowHeight; let adjInitMouseY = mouseY - rowHeight - 100; //rowHeight: height of the column menu cells | 100: height of the top menu let yOffset = this._lowestSelectedIndex * rowHeight; @@ -959,6 +960,9 @@ export class CollectionSchemaView extends CollectionSubView() { if (DragManager.docsBeingDragged.length){ this._mouseCoordinates = { x: e.clientX, y: e.clientY }; } + // let newIndex = this.findColDropIndex(e.clientX); + // if (newIndex != this._draggedColIndex) this.moveColumn(this._draggedColIndex, newIndex ?? this._draggedColIndex); + // this._draggedColIndex = newIndex ? newIndex : this._draggedColIndex; } @computed get sortedDocs() { |