Fix rows not deselecting with single click on one item.

Closes #2241
This commit is contained in:
Adomas Venčkauskas 2021-11-08 14:06:23 +02:00
parent 80be9f9e3a
commit b9e1923656
2 changed files with 4 additions and 5 deletions

View file

@ -687,10 +687,8 @@ class VirtualizedTable extends React.Component {
this._isMouseDrag = false; this._isMouseDrag = false;
return; return;
} }
if (shiftSelect || toggleSelection) {
this._onSelection(index, shiftSelect, toggleSelection); this._onSelection(index, shiftSelect, toggleSelection);
} }
}
_activateNode = (event, indices) => { _activateNode = (event, indices) => {
indices = indices || Array.from(this.selection.selected); indices = indices || Array.from(this.selection.selected);

View file

@ -2664,13 +2664,14 @@ var ItemTree = class ItemTree extends LibraryTree {
this.onDrop(e, index); this.onDrop(e, index);
}, { passive: true }); }, { passive: true });
} }
div.addEventListener('mousedown', e => this._handleRowMouseDown(e, index), { passive : true }); div.addEventListener('mousedown', this._handleRowMouseUpDown, { passive: true });
div.addEventListener('mouseup', this._handleRowMouseUpDown, { passive: true });
} }
return div; return div;
}; };
_handleRowMouseDown = (event, index) => { _handleRowMouseUpDown = (event) => {
const modifierIsPressed = ['ctrlKey', 'metaKey', 'shiftKey', 'altKey'].some(key => event[key]); const modifierIsPressed = ['ctrlKey', 'metaKey', 'shiftKey', 'altKey'].some(key => event[key]);
if (this.collectionTreeRow.isDuplicates() && !modifierIsPressed) { if (this.collectionTreeRow.isDuplicates() && !modifierIsPressed) {
this.duplicateMouseSelection = true; this.duplicateMouseSelection = true;