Restore ability to select individual items in duplicates view.
Closes #2225. Only mouse clicks without modifiers will select the group of duplicate items. This is the same behavior as with the XUL tree.
This commit is contained in:
parent
bc8b1a7c6d
commit
aa7e502bad
2 changed files with 13 additions and 2 deletions
|
@ -687,7 +687,9 @@ class VirtualizedTable extends React.Component {
|
|||
this._isMouseDrag = false;
|
||||
return;
|
||||
}
|
||||
this._onSelection(index, shiftSelect, toggleSelection);
|
||||
if (shiftSelect || toggleSelection) {
|
||||
this._onSelection(index, shiftSelect, toggleSelection);
|
||||
}
|
||||
}
|
||||
|
||||
_activateNode = (event, indices) => {
|
||||
|
|
|
@ -2664,14 +2664,22 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
this.onDrop(e, index);
|
||||
}, { passive: true });
|
||||
}
|
||||
div.addEventListener('mousedown', e => this._handleRowMouseDown(e, index), { passive : true });
|
||||
}
|
||||
|
||||
return div;
|
||||
};
|
||||
|
||||
_handleRowMouseDown = (event, index) => {
|
||||
const modifierIsPressed = ['ctrlKey', 'metaKey', 'shiftKey', 'altKey'].some(key => event[key]);
|
||||
if (this.collectionTreeRow.isDuplicates() && !modifierIsPressed) {
|
||||
this.duplicateMouseSelection = true;
|
||||
}
|
||||
}
|
||||
|
||||
_handleSelectionChange = (selection, shouldDebounce) => {
|
||||
// Update aria-activedescendant on the tree
|
||||
if (this.collectionTreeRow.isDuplicates() && selection.count == 1) {
|
||||
if (this.collectionTreeRow.isDuplicates() && selection.count == 1 && this.duplicateMouseSelection) {
|
||||
var itemID = this.getRow(selection.focused).ref.id;
|
||||
var setItemIDs = this.collectionTreeRow.ref.getSetItemsByItemID(itemID);
|
||||
|
||||
|
@ -2682,6 +2690,7 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
this.tree.invalidateRow(this._rowMap[id]);
|
||||
}
|
||||
}
|
||||
this.duplicateMouseSelection = false;
|
||||
if (shouldDebounce) {
|
||||
this._onSelectionChangeDebounced();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue