Scroll collection into view on collection-containing-an-item

This commit is contained in:
Dan Stillman 2015-09-24 06:46:02 -04:00
parent b2f0d3beb0
commit a5eb5a5af5

View File

@ -384,10 +384,17 @@ Zotero.CollectionTreeView.prototype.setHighlightedRows = function (ids) {
this._highlightedRows = {}; this._highlightedRows = {};
this._treebox.invalidate(); this._treebox.invalidate();
var scrolled = false;
for each(var id in ids) { for each(var id in ids) {
let row = this._collectionRowMap[id];
this.expandToCollection(id); this.expandToCollection(id);
this._highlightedRows[this._collectionRowMap[id]] = true; // TODO: Scroll a little above or below
this._treebox.invalidateRow(this._collectionRowMap[id]); if (!scrolled) {
this._treebox.ensureRowIsVisible(row);
scrolled = true;
}
this._highlightedRows[row] = true;
this._treebox.invalidateRow(row);
} }
} }