commit 16a58c03be41d4868438ed2c775f1f8b66c2db96 parent 934545260180e5816cbf6e42d7b67e701fd7bdcb Author: Dan Stillman <dstillman@zotero.org> Date: Mon, 9 May 2016 13:58:33 -0400 Save scroll position across non-selected changes for collections view Diffstat:
| M | chrome/content/zotero/xpcom/collectionTreeView.js | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -364,6 +364,12 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function* var currentTreeRow = this.getRow(this.selection.currentIndex); this.selection.selectEventsSuppressed = true; + // If there's not at least one new collection to be selected, get a scroll position to restore later + var scrollPosition = false; + if (action != 'add' || ids.every(id => extraData[id] && extraData[id].skipSelect)) { + scrollPosition = this._saveScrollPosition(); + } + if (action == 'delete') { var selectedIndex = this.selection.count ? this.selection.currentIndex : 0; @@ -513,6 +519,8 @@ Zotero.CollectionTreeView.prototype.notify = Zotero.Promise.coroutine(function* } } + this._rememberScrollPosition(scrollPosition); + var deferred = Zotero.Promise.defer(); this.addEventListener('select', () => deferred.resolve()); this.selection.selectEventsSuppressed = false;