mirror of
https://github.com/zotero/zotero.git
synced 2026-10-04 02:31:47 +00:00
scroll to pivot row on arrowUp/Down in duplicates (#4822)
When items are selected, itemTree scrolls to them. Depending on the arrangement of items, it will often default to scrolling to the top-most item in the selection, which is not the focused row in case of duplicates view. To scroll to focused row without unnecessary scrolling or items visibly jumping to one row and then another, added option to skip scrolling in itemTree.selectItems.
This commit is contained in:
parent
bc62bbfdda
commit
5b2e666f4f
1 changed files with 11 additions and 4 deletions
|
|
@ -993,7 +993,13 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
var setItemIDs = this.collectionTreeRow.ref.getSetItemsByItemID(nextItem.id);
|
||||
this.selection.focused = nextRowIndex;
|
||||
|
||||
this.selectItems(setItemIDs);
|
||||
this.selectItems(setItemIDs, false, true).then(() => {
|
||||
// make sure the focused row is visible
|
||||
if (!this.tree.rowIsVisible(nextRowIndex)) {
|
||||
this.ensureRowIsVisible(nextRowIndex);
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1152,7 +1158,7 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
return this.selectItems([id], noRecurse);
|
||||
}
|
||||
|
||||
async selectItems(ids, noRecurse) {
|
||||
async selectItems(ids, noRecurse, noScroll) {
|
||||
if (!ids.length) return 0;
|
||||
|
||||
// If no row map, we're probably in the process of switching collections,
|
||||
|
|
@ -1274,8 +1280,9 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
|
||||
this.selection.selectEventsSuppressed = false;
|
||||
}
|
||||
|
||||
this.ensureRowsAreVisible(rowsToSelect);
|
||||
if (!noScroll) {
|
||||
this.ensureRowsAreVisible(rowsToSelect);
|
||||
}
|
||||
|
||||
return rowsToSelect.length;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue