fix incorrect usages of getBoundingClientRect

This commit is contained in:
Aran-Fey
2024-11-13 10:43:43 +01:00
parent 5a175c21f0
commit 393750e20d
13 changed files with 116 additions and 65 deletions

View File

@@ -1,5 +1,6 @@
import { fillToCss } from "../cssUtils";
import { AnyFill } from "../dataModels";
import { getAllocatedHeightInPx, getAllocatedWidthInPx } from "../utils";
import { ComponentBase, ComponentState } from "./componentBase";
type PlotlyType = any;
@@ -142,11 +143,9 @@ class PlotlyManager implements PlotManager {
// Plotly is too stupid to layout itself. Help out.
this.resizeObserver = new ResizeObserver(() => {
// Inform plotly of the new size
let layout = this.element.getBoundingClientRect();
Plotly.relayout(this.plotDiv, {
width: layout.width,
height: layout.height,
width: getAllocatedWidthInPx(this.element),
height: getAllocatedHeightInPx(this.element),
});
});
this.resizeObserver.observe(this.element);