Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/view/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,11 @@ export class LayoutInternal extends React.Component<ILayoutInternalProps, ILayou
this.layoutWindow.window = this.currentWindow;
this.layoutWindow.toScreenRectFunction = (r) => this.getScreenRect(r);

this.resizeObserver = new ResizeObserver(entries => {
requestAnimationFrame(() => {
// Spec says ResizeObserver triggers callback in the same window as the observed element,
// but it's just not true in Chrome, so, use ResizeObserver from PARENT window
const parentWindow = (this.currentDocument.defaultView ?? window);
this.resizeObserver = new parentWindow.ResizeObserver(entries => {
parentWindow.requestAnimationFrame(() => {
this.updateRect();
});
});
Expand All @@ -279,7 +282,7 @@ export class LayoutInternal extends React.Component<ILayoutInternalProps, ILayou
this.currentWindow.addEventListener("resize", () => {
this.updateRect();
});

this.resizeObserver.observe(this.currentWindow.document.documentElement);
const sourceElement = this.props.mainLayout!.getRootDiv()!;
const targetElement = this.selfRef.current!;

Expand Down