Skip to content

Commit 6fa3243

Browse files
committed
Fix focusIndicator cell part addition #131808
1 parent c79072c commit 6fa3243

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

src/vs/workbench/contrib/notebook/browser/view/cellParts/cellFocusIndicator.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import * as DOM from 'vs/base/browser/dom';
77
import { FastDomNode } from 'vs/base/browser/fastDomNode';
8-
import { DisposableStore } from 'vs/base/common/lifecycle';
98
import { CodeCellLayoutInfo, ICellViewModel, INotebookEditorDelegate } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
109
import { CellViewModelStateChangeEvent } from 'vs/workbench/contrib/notebook/browser/notebookViewEvents';
1110
import { CellPart } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellPart';
@@ -68,11 +67,14 @@ export class CellFocusIndicator extends CellPart {
6867
this.currentElement.isOutputCollapsed = !this.currentElement.isOutputCollapsed;
6968
}
7069
}));
70+
71+
this._register(this.titleToolbar.onDidUpdateActions(() => {
72+
this.updateFocusIndicatorsForTitleMenu();
73+
}));
7174
}
7275

7376
renderCell(element: ICellViewModel, templateData: BaseCellRenderTemplate): void {
7477
this.currentElement = element;
75-
this.updateFocusIndicatorsForTitleMenuAndSubscribe(element, templateData.elementDisposables);
7678
}
7779

7880
prepareLayout(): void {
@@ -99,29 +101,14 @@ export class CellFocusIndicator extends CellPart {
99101
this.outputFocusIndicator.setHeight(Math.max(cell.layoutInfo.outputIndicatorHeight - cell.viewContext.notebookOptions.getLayoutConfiguration().focusIndicatorGap, 0));
100102
this.bottom.domNode.style.transform = `translateY(${cell.layoutInfo.totalHeight - bottomToolbarDimensions.bottomToolbarGap - layoutInfo.cellBottomMargin}px)`;
101103
}
104+
105+
this.updateFocusIndicatorsForTitleMenu();
102106
}
103107

104108
updateState(element: ICellViewModel, e: CellViewModelStateChangeEvent): void {
105109
// nothing to update
106110
}
107111

108-
private updateFocusIndicatorsForTitleMenuAndSubscribe(element: ICellViewModel, disposables: DisposableStore) {
109-
// todo@rebornix, consolidate duplicated requests in next frame
110-
disposables.add(DOM.scheduleAtNextAnimationFrame(() => {
111-
this.updateFocusIndicatorsForTitleMenu();
112-
}));
113-
114-
disposables.add(element.onDidChangeLayout(() => {
115-
disposables.add(DOM.scheduleAtNextAnimationFrame(() => {
116-
this.updateFocusIndicatorsForTitleMenu();
117-
}));
118-
}));
119-
120-
disposables.add(this.titleToolbar.onDidUpdateActions(() => {
121-
this.updateFocusIndicatorsForTitleMenu();
122-
}));
123-
}
124-
125112
private updateFocusIndicatorsForTitleMenu(): void {
126113
const layoutInfo = this.notebookEditor.notebookOptions.getLayoutConfiguration();
127114
if (this.titleToolbar.hasActions) {
@@ -132,5 +119,4 @@ export class CellFocusIndicator extends CellPart {
132119
this.right.domNode.style.transform = `translateY(${layoutInfo.cellTopMargin}px)`;
133120
}
134121
}
135-
136122
}

0 commit comments

Comments
 (0)