diff --git a/static/js/dark.js b/static/js/dark.js index 075b5a1..6e96997 100644 --- a/static/js/dark.js +++ b/static/js/dark.js @@ -539,8 +539,10 @@ function reassemble() { var vbox = sym.viewBox.baseVal; // TODO: handle browsers without baseVal // TODO: handle origins other than 0,0 - var scale = width / vbox.width; - var vscale = height / vbox.height; + // Firefox fucks up its dimension calculation + var parentDims = trace.parentElement.getBoundingClientRect(); + var scale = parentDims.width / vbox.width; + var vscale = parentDims.height / vbox.height; // if(scale > vscale * 1.01 || scale < vscale * 0.99) // console.warn(`incompatible scales: ${scale}, ${vscale}`); var paths = symbolCache[sym.id]; diff --git a/static/js/dark.ts b/static/js/dark.ts index f5c9a7c..aff7b96 100644 --- a/static/js/dark.ts +++ b/static/js/dark.ts @@ -553,8 +553,11 @@ function reassemble() { // TODO: handle browsers without baseVal // TODO: handle origins other than 0,0 - const scale = width / vbox.width; - const vscale = height / vbox.height; + // Firefox fucks up its dimension calculation + const parentDims = trace.parentElement!.getBoundingClientRect(); + + const scale = parentDims.width / vbox.width; + const vscale = parentDims.height / vbox.height; // if(scale > vscale * 1.01 || scale < vscale * 0.99) // console.warn(`incompatible scales: ${scale}, ${vscale}`); const paths: string[] | undefined = symbolCache[sym.id];