未验证 提交 47736a99 编写于 作者: J Joao Moreno

fixes #84915

上级 f46ae8ff
......@@ -1417,8 +1417,13 @@ export abstract class AbstractTree<T, TFilterData, TRef> implements IDisposable
return this.view.renderHeight;
}
get firstVisibleElement(): T {
get firstVisibleElement(): T | undefined {
const index = this.view.firstVisibleIndex;
if (index < 0 || index >= this.view.length) {
return undefined;
}
const node = this.view.element(index);
return node.element;
}
......
......@@ -422,10 +422,6 @@ export class AsyncDataTree<TInput, T, TFilterData = void> implements IDisposable
return this.tree.renderHeight;
}
get firstVisibleElement(): T {
return this.tree.firstVisibleElement!.element as T;
}
get lastVisibleElement(): T {
return this.tree.lastVisibleElement!.element as T;
}
......
......@@ -555,7 +555,11 @@ export class SettingsEditor2 extends BaseEditor {
if (DOM.findParentWithClass(e.relatedTarget, 'settings-editor-tree')) {
if (this.settingsTree.scrollTop > 0) {
const firstElement = this.settingsTree.firstVisibleElement;
this.settingsTree.reveal(firstElement, 0.1);
if (typeof firstElement !== 'undefined') {
this.settingsTree.reveal(firstElement, 0.1);
}
return true;
}
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册