Skip to content

Commit

Permalink
fixes #66863
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Jan 24, 2019
1 parent 52004d2 commit 15b279c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/vs/base/browser/ui/tree/abstractTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ interface ITreeRendererOptions {

class TreeRenderer<T, TFilterData, TTemplateData> implements IListRenderer<ITreeNode<T, TFilterData>, ITreeListTemplateData<TTemplateData>> {

private static DefaultIndent = 8;

readonly templateId: string;
private renderedElements = new Map<T, ITreeNode<T, TFilterData>>();
private renderedNodes = new Map<ITreeNode<T, TFilterData>, ITreeListTemplateData<TTemplateData>>();
Expand All @@ -201,7 +203,7 @@ class TreeRenderer<T, TFilterData, TTemplateData> implements IListRenderer<ITree
}

updateOptions(options: ITreeRendererOptions = {}): void {
this.indent = typeof options.indent === 'number' ? options.indent : 8;
this.indent = typeof options.indent === 'number' ? Math.max(options.indent, 0) : TreeRenderer.DefaultIndent;

this.renderedNodes.forEach((templateData, node) => {
templateData.twistie.style.marginLeft = `${node.depth * this.indent}px`;
Expand All @@ -221,7 +223,8 @@ class TreeRenderer<T, TFilterData, TTemplateData> implements IListRenderer<ITree
this.renderedNodes.set(node, templateData);
this.renderedElements.set(node.element, node);

templateData.twistie.style.marginLeft = `${node.depth * this.indent}px`;
const indent = TreeRenderer.DefaultIndent + (node.depth - 1) * this.indent;
templateData.twistie.style.marginLeft = `${indent}px`;
this.renderTwistie(node, templateData.twistie);

this.renderer.renderElement(node, index, templateData.templateData);
Expand Down

0 comments on commit 15b279c

Please sign in to comment.