From 54da12a1321a84492b334fa37eb14d36656928ca Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Wed, 10 Feb 2021 08:08:46 +0100 Subject: [PATCH] Fix tree layout on failed let --- frontend/src/mathjax-proof-tree.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/frontend/src/mathjax-proof-tree.ts b/frontend/src/mathjax-proof-tree.ts index 3b39b31..0789e9c 100644 --- a/frontend/src/mathjax-proof-tree.ts +++ b/frontend/src/mathjax-proof-tree.ts @@ -163,13 +163,15 @@ class MathjaxProofTree extends MathjaxAdapter { } parentNode = parentNode.childNodes[2] as SVGGraphicsElement; const rule = node.querySelector('g [semantics="bspr_inferenceRule:down"]')!; - // this selector should be checked again when updating MathJax - const term = rule.childNodes[1].childNodes[0].childNodes[0].childNodes[1].childNodes[0] as SVGGraphicsElement; - // @ts-ignore - let w = -parentNode.getTransformToElement(term).e; - w += term.getBBox().width; - w += padding; - parentNode.setAttribute("x2", w.toString()); + if (rule !== null) { + // this selector should be checked again when updating MathJax + const term = rule.childNodes[1].childNodes[0].childNodes[0].childNodes[1].childNodes[0] as SVGGraphicsElement; + // @ts-ignore + let w = -parentNode.getTransformToElement(term).e; + w += term.getBBox().width; + w += padding; + parentNode.setAttribute("x2", w.toString()); + } } i += 1; }