提交 209c2e72 编写于 作者: R rebornix

List Output resize flashing.

上级 e0b9c763
......@@ -1134,6 +1134,10 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
return 0;
}
if (!!this.virtualDelegate.hasDynamicHeight && !this.virtualDelegate.hasDynamicHeight(item.element)) {
return 0;
}
const size = item.size;
if (item.row && item.row.domNode) {
......
......@@ -271,8 +271,7 @@ export class BackLayerWebView extends Disposable {
let outputIndex = cell.outputs.indexOf(output);
cell.updateOutputHeight(outputIndex, outputHeight);
let totalOutputHeight = cell.getOutputTotalHeight();
cell.dynamicHeight = editorHeight + 32 /* code cell padding */ + totalOutputHeight;
this.notebookEditor.layoutNotebookCell(cell, cell.dynamicHeight);
this.notebookEditor.layoutNotebookCell(cell, editorHeight + 32 /* code cell padding */ + totalOutputHeight);
}
} else if (data.type === 'scroll-ack') {
// const date = new Date();
......
......@@ -311,6 +311,10 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
}
renderElement(element: CellViewModel, index: number, templateData: CellRenderTemplate, height: number | undefined): void {
if (height === undefined) {
return;
}
if (templateData.outputContainer) {
templateData.outputContainer!.innerHTML = '';
}
......
......@@ -21,7 +21,6 @@ export class CellViewModel extends Disposable {
private _mdRenderer: MarkdownRenderer | null = null;
private _html: HTMLElement | null = null;
private _dynamicHeight: number | null = null;
protected readonly _onDidDispose = new Emitter<void>();
readonly onDidDispose = this._onDidDispose.event;
protected readonly _onDidChangeEditingState = new Emitter<void>();
......@@ -49,14 +48,15 @@ export class CellViewModel extends Disposable {
this._onDidChangeEditingState.fire();
}
set dynamicHeight(height: number | null) {
this._dynamicHeight = height;
}
private _selfSizeMonitoring: boolean = false;
get dynamicHeight(): number | null {
return this._dynamicHeight;
set selfSizeMonitoring(newVal: boolean) {
this._selfSizeMonitoring = newVal;
}
get selfSizeMonitoring() {
return this._selfSizeMonitoring;
}
private _editorHeight = 0;
set editorHeight(height: number) {
......@@ -146,7 +146,7 @@ export class CellViewModel extends Disposable {
//#endregion
hasDynamicHeight() {
if (this._dynamicHeight !== null) {
if (this.selfSizeMonitoring) {
// if there is an output rendered in the webview, it should always be false
return false;
}
......
......@@ -104,16 +104,18 @@ export class CodeCell extends Disposable {
this._register(templateData.editor!.onDidContentSizeChange((e) => {
if (e.contentHeightChanged) {
let layout = templateData.editor!.getLayoutInfo();
if (layout.height !== e.contentHeight) {
let currContentHeight = templateData.editor!.getContentHeight();
if (currContentHeight !== e.contentHeight) {
templateData.editor?.layout(
{
width: layout.width,
width: currContentHeight,
height: e.contentHeight
}
);
}
if (viewCell.editorHeight !== currContentHeight) {
viewCell.editorHeight = e.contentHeight;
if (viewCell.outputs.length) {
......@@ -122,7 +124,9 @@ export class CodeCell extends Disposable {
} else {
notebookEditor.layoutNotebookCell(viewCell, viewCell.editorHeight + 32);
}
}
}
}));
......@@ -252,6 +256,7 @@ export class CodeCell extends Disposable {
}
if (result.shadowContent) {
this.viewCell.selfSizeMonitoring = true;
let editorHeight = this.viewCell.editorHeight;
this.notebookEditor.createInset(this.viewCell, currOutput, result.shadowContent, editorHeight + 8 + this.viewCell.getOutputOffset(index));
} else {
......@@ -284,7 +289,6 @@ export class CodeCell extends Disposable {
this.viewCell.updateOutputHeight(currIndex, height);
const editorHeight = this.viewCell.editorHeight;
const totalOutputHeight = this.viewCell.getOutputTotalHeight();
this.viewCell.dynamicHeight = editorHeight + 32 + totalOutputHeight;
this.notebookEditor.layoutNotebookCell(this.viewCell, editorHeight + 32 + totalOutputHeight);
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册