Fix trees not properly redrawing on drag events

This commit is contained in:
Adomas Venčkauskas 2021-04-14 14:37:47 +03:00 committed by Dan Stillman
parent b671611b51
commit 9c7f28b126
2 changed files with 4 additions and 2 deletions

View file

@ -1168,6 +1168,7 @@ var CollectionTree = class CollectionTree extends LibraryTree {
try {
// Prevent modifier keys from doing their normal things
event.preventDefault();
var previousOrientation = Zotero.DragDrop.currentOrientation;
Zotero.DragDrop.currentOrientation = getDragTargetOrient(event);
if (!this.canDropCheck(index, Zotero.DragDrop.currentOrientation, event.dataTransfer)) {
@ -1260,7 +1261,7 @@ var CollectionTree = class CollectionTree extends LibraryTree {
} else {
this._dropRow = null;
}
if (prevDropRow != this._dropRow) {
if (prevDropRow != this._dropRow || previousOrientation != Zotero.DragDrop.currentOrientation) {
typeof prevDropRow == 'number' && this.tree.invalidateRow(prevDropRow);
this.tree.invalidateRow(index);
}

View file

@ -2053,6 +2053,7 @@ var ItemTree = class ItemTree extends LibraryTree {
try {
event.preventDefault();
event.stopPropagation();
var previousOrientation = Zotero.DragDrop.currentOrientation;
Zotero.DragDrop.currentOrientation = getDragTargetOrient(event);
Zotero.debug(`Dragging over item ${row} with ${Zotero.DragDrop.currentOrientation}, drop row: ${this._dropRow}`);
@ -2144,7 +2145,7 @@ var ItemTree = class ItemTree extends LibraryTree {
} else {
this._dropRow = null;
}
if (prevDropRow != this._dropRow) {
if (prevDropRow != this._dropRow || previousOrientation != Zotero.DragDrop.currentOrientation) {
typeof prevDropRow == 'number' && this.tree.invalidateRow(prevDropRow);
this.tree.invalidateRow(row);
}