Skip to content

Commit 093e2b9

Browse files
authored
SCM Graph - simplify margin rendering (microsoft#249386)
SCM Grapg - simplify margin rendering
1 parent 4d11fc7 commit 093e2b9

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

src/vs/workbench/contrib/scm/browser/media/scm.css

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,24 +133,16 @@
133133
align-items: center;
134134
}
135135

136-
.scm-view .monaco-list-row .history-item > .margin {
137-
height: 22px;
138-
border-left: 3px;
139-
border-left-style: solid;
140-
}
141-
142-
.scm-view .monaco-list-row .monaco-tl-twistie.collapsed + .monaco-tl-contents > .history-item > .margin {
143-
visibility: hidden;
144-
}
145-
146-
.scm-view .monaco-list-row .monaco-tl-twistie:not(.collapsed) + .monaco-tl-contents > .history-item > .margin {
147-
visibility: visible;
136+
.scm-view .monaco-list-row .monaco-tl-twistie.collapsed + .monaco-tl-contents > .history-item > .graph-container {
137+
border-left-color: transparent !important;
148138
}
149139

150140
.scm-view .monaco-list-row .history-item > .graph-container {
151141
display: flex;
152142
flex-shrink: 0;
153143
height: 22px;
144+
border-left-width: 3px;
145+
border-left-style: solid;
154146
}
155147

156148
.scm-view .monaco-list-row .history-item > .graph-container.current > .graph > circle:last-child {
@@ -647,14 +639,11 @@
647639
align-items: center;
648640
}
649641

650-
.scm-view .monaco-list-row .history-item-change > .margin {
642+
.scm-view .monaco-list-row .history-item-change > .graph-placeholder {
651643
height: 22px;
652644
border-left-width: 3px;
653645
border-left-style: solid;
654646
}
655-
.scm-view .monaco-list-row .history-item-change > .graph-placeholder {
656-
height: 22px;
657-
}
658647

659648
.scm-view .monaco-list-row .history-item-change > .label-container {
660649
display: flex;

src/vs/workbench/contrib/scm/browser/scmHistoryViewPane.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ class ListDelegate implements IListVirtualDelegate<TreeElement> {
340340

341341
interface HistoryItemTemplate {
342342
readonly element: HTMLElement;
343-
readonly margin: HTMLElement;
344343
readonly label: IconLabel;
345344
readonly graphContainer: HTMLElement;
346345
readonly actionBar: WorkbenchToolBar;
@@ -377,7 +376,6 @@ class HistoryItemRenderer implements ITreeRenderer<SCMHistoryItemViewModelTreeEl
377376
(container.parentElement!.parentElement!.querySelector('.monaco-tl-twistie')! as HTMLElement).classList.add('force-no-twistie');
378377

379378
const element = append(container, $('.history-item'));
380-
const margin = append(element, $('.margin'));
381379
const graphContainer = append(element, $('.graph-container'));
382380
const iconLabel = new IconLabel(element, {
383381
supportIcons: true, supportHighlights: true, supportDescriptionHighlights: true
@@ -388,7 +386,7 @@ class HistoryItemRenderer implements ITreeRenderer<SCMHistoryItemViewModelTreeEl
388386
const actionsContainer = append(element, $('.actions'));
389387
const actionBar = new WorkbenchToolBar(actionsContainer, undefined, this._menuService, this._contextKeyService, this._contextMenuService, this._keybindingService, this._commandService, this._telemetryService);
390388

391-
return { element, margin, graphContainer, label: iconLabel, labelContainer, actionBar, elementDisposables: new DisposableStore(), disposables: combinedDisposable(iconLabel, actionBar) };
389+
return { element, graphContainer, label: iconLabel, labelContainer, actionBar, elementDisposables: new DisposableStore(), disposables: combinedDisposable(iconLabel, actionBar) };
392390
}
393391

394392
renderElement(node: ITreeNode<SCMHistoryItemViewModelTreeElement, LabelFuzzyScore>, index: number, templateData: HistoryItemTemplate, height: number | undefined): void {
@@ -401,11 +399,10 @@ class HistoryItemRenderer implements ITreeRenderer<SCMHistoryItemViewModelTreeEl
401399
});
402400
templateData.elementDisposables.add(historyItemHover);
403401

404-
templateData.margin.style.borderLeftColor = asCssVariable(getHistoryItemColor(historyItemViewModel));
405-
406402
templateData.graphContainer.textContent = '';
407403
templateData.graphContainer.classList.toggle('current', historyItemViewModel.isCurrent);
408404
templateData.graphContainer.appendChild(renderSCMHistoryItemGraph(historyItemViewModel));
405+
templateData.graphContainer.style.borderLeftColor = asCssVariable(getHistoryItemColor(historyItemViewModel));
409406

410407
const historyItemRef = provider.historyProvider.get()?.historyItemRef?.get();
411408
const extraClasses = historyItemRef?.revision === historyItem.id ? ['history-item-current'] : [];
@@ -545,7 +542,6 @@ class HistoryItemRenderer implements ITreeRenderer<SCMHistoryItemViewModelTreeEl
545542

546543
interface HistoryItemChangeTemplate {
547544
readonly element: HTMLElement;
548-
readonly margin: HTMLElement;
549545
readonly graphPlaceholder: HTMLElement;
550546
readonly resourceLabel: IResourceLabel;
551547
readonly actionBar: WorkbenchToolBar;
@@ -571,7 +567,6 @@ class HistoryItemChangeRenderer implements ITreeRenderer<SCMHistoryItemChangeVie
571567
(container.parentElement!.parentElement!.querySelector('.monaco-tl-twistie')! as HTMLElement).classList.add('force-no-twistie');
572568

573569
const element = append(container, $('.history-item-change'));
574-
const margin = append(element, $('.margin'));
575570
const graphPlaceholder = append(element, $('.graph-placeholder'));
576571

577572
const labelContainer = append(element, $('.label-container'));
@@ -584,17 +579,16 @@ class HistoryItemChangeRenderer implements ITreeRenderer<SCMHistoryItemChangeVie
584579
const actionBar = new WorkbenchToolBar(actionsContainer, undefined, this._menuService, this._contextKeyService, this._contextMenuService, this._keybindingService, this._commandService, this._telemetryService);
585580
disposables.add(actionBar);
586581

587-
return { element, margin, graphPlaceholder, resourceLabel, actionBar, disposables };
582+
return { element, graphPlaceholder, resourceLabel, actionBar, disposables };
588583
}
589584

590585
renderElement(element: ITreeNode<SCMHistoryItemChangeViewModelTreeElement, void>, index: number, templateData: HistoryItemChangeTemplate, height: number | undefined): void {
591586
const historyItemViewModel = element.element.historyItemViewModel;
592587
const historyItemChange = element.element.historyItemChange;
593588

594-
templateData.margin.style.borderLeftColor = asCssVariable(getHistoryItemColor(historyItemViewModel));
595-
596589
templateData.graphPlaceholder.textContent = '';
597590
templateData.graphPlaceholder.style.width = `${SWIMLANE_WIDTH * (element.element.graphColumns.length + 1)}px`;
591+
templateData.graphPlaceholder.style.borderLeftColor = asCssVariable(getHistoryItemColor(historyItemViewModel));
598592
templateData.graphPlaceholder.appendChild(renderSCMHistoryGraphPlaceholder(element.element.graphColumns));
599593

600594
const uri = historyItemChange.uri;

0 commit comments

Comments
 (0)