Item Tree: Reset scrollbar to top on collection change
This commit is contained in:
parent
25230b0fca
commit
227b6354de
2 changed files with 3 additions and 1 deletions
|
@ -164,7 +164,7 @@ module.exports = class {
|
|||
* @param scrollOffset {Integer} offset for the top of the tree
|
||||
*/
|
||||
scrollTo(scrollOffset) {
|
||||
const maxOffset = this.itemHeight * this._getItemCount() - this.getWindowHeight();
|
||||
const maxOffset = Math.max(0, this.itemHeight * this._getItemCount() - this.getWindowHeight());
|
||||
scrollOffset = Math.min(Math.max(0, scrollOffset), maxOffset);
|
||||
this.scrollOffset = scrollOffset;
|
||||
this.targetElement.scrollTop = scrollOffset;
|
||||
|
|
|
@ -1021,6 +1021,8 @@ var ItemTree = class ItemTree extends LibraryTree {
|
|||
}
|
||||
this.forceUpdate(() => {
|
||||
this.selection.selectEventsSuppressed = false;
|
||||
// Reset scrollbar to top
|
||||
this._treebox && this._treebox.scrollTo(0);
|
||||
this._updateIntroText();
|
||||
this._itemTreeLoadingDeferred.resolve();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue