From 1d6e149853ecc7994527cf9435f03c28e7e585e5 Mon Sep 17 00:00:00 2001 From: rebornix Date: Thu, 26 Mar 2020 13:47:27 -0700 Subject: [PATCH] Output Offset API is offset in the whole cell. --- .../notebook/browser/view/renderers/backLayerWebView.ts | 7 ++----- .../contrib/notebook/browser/view/renderers/codeCell.ts | 3 +-- .../notebook/browser/viewModel/codeCellViewModel.ts | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts index 5274d668ed6..b710731bda2 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts @@ -322,9 +322,7 @@ export class BackLayerWebView extends Disposable { shouldUpdateInset(cell: CodeCellViewModel, output: IOutput, cellTop: number) { let outputCache = this.insetMapping.get(output)!; let outputIndex = cell.outputs.indexOf(output); - - let outputOffsetInOutputContainer = cell.getOutputOffset(outputIndex); - let outputOffset = cellTop + cell.layoutInfo.editorHeight + outputOffsetInOutputContainer; + let outputOffset = cellTop + cell.getOutputOffset(outputIndex); if (outputOffset === outputCache.cacheOffset) { return false; @@ -339,8 +337,7 @@ export class BackLayerWebView extends Disposable { let id = outputCache.outputId; let outputIndex = item.cell.outputs.indexOf(item.output); - let outputOffsetInOutputContainer = item.cell.getOutputOffset(outputIndex); - let outputOffset = item.cellTop + item.cell.layoutInfo.outputContainerOffset + outputOffsetInOutputContainer; + let outputOffset = item.cellTop + item.cell.getOutputOffset(outputIndex); outputCache.cacheOffset = outputOffset; return { diff --git a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts index a9d14a9107f..23dbf910225 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts @@ -263,8 +263,7 @@ export class CodeCell extends Disposable { if (result.shadowContent) { this.viewCell.selfSizeMonitoring = true; - let editorHeight = this.viewCell.layoutInfo.editorHeight; - this.notebookEditor.createInset(this.viewCell, currOutput, result.shadowContent, editorHeight + this.viewCell.getOutputOffset(index)); + this.notebookEditor.createInset(this.viewCell, currOutput, result.shadowContent, this.viewCell.getOutputOffset(index)); } else { DOM.addClass(outputItemDiv, 'foreground'); } diff --git a/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts b/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts index 9aeee392f91..cabab7eb314 100644 --- a/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts +++ b/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.ts @@ -193,8 +193,8 @@ export class CodeCellViewModel extends BaseCellViewModel implements ICellViewMod } this._ensureOutputsTop(); - - return this._outputsTop!.getAccumulatedValue(index - 1); + const offset = this._outputsTop!.getAccumulatedValue(index - 1); + return this.layoutInfo.outputContainerOffset + offset; } spliceOutputHeights(start: number, deleteCnt: number, heights: number[]) { -- GitLab