Try passing offset to editors on layout (#164287)

* Try passing offset to editors on layout

When a notebook editor is created, it currently has to force a relayout to determine where the overlay webview should be positioned. We do this with a call to `getBoundingClientRect`

However the grid view should already have information about where the editor is positioned. If we can use this, then we can skip the expensive call to `getBoundingClientRect` entirely

This change attempts to pass the `top` and `left` offsets to the `EditorGroupView` and eventually down into `NotebookEditorWidget`

The PR does not work properly however as the offset that the `EditorGroupView` gets is wrong. I've added some todo comments about where this seems to be happening

* Remove todo and update layout over
This commit is contained in:
Matt Bierner
2022-11-04 23:15:06 -07:00
committed by GitHub
parent 05ec316171
commit 7acbd9df69
6 changed files with 64 additions and 41 deletions

View File

@@ -417,7 +417,12 @@ export class Dimension implements IDimension {
}
}
export function getTopLeftOffset(element: HTMLElement): { left: number; top: number } {
export interface IDomPosition {
readonly left: number;
readonly top: number;
}
export function getTopLeftOffset(element: HTMLElement): IDomPosition {
// Adapted from WinJS.Utilities.getPosition
// and added borders to the mix