mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-09 10:50:42 +00:00
Fix issue #31
This commit is contained in:
parent
cfb27e3de3
commit
da87576326
@ -79,10 +79,11 @@ class MathjaxProofTree extends MathjaxAdapter {
|
|||||||
|
|
||||||
console.time('stepCalculation');
|
console.time('stepCalculation');
|
||||||
const svg = this.shadowRoot!.querySelector<SVGElement>("svg")!;
|
const svg = this.shadowRoot!.querySelector<SVGElement>("svg")!;
|
||||||
let root = this.shadowRoot!.querySelector("#typicalc-prooftree")! as SVGElement;
|
let root = this.shadowRoot!.querySelector("#typicalc-prooftree") as SVGElement || this.shadowRoot!.querySelector("semantics") as SVGElement;
|
||||||
while (!root.getAttribute("semantics")) {
|
while (!root.getAttribute("semantics")) {
|
||||||
root = root.parentNode! as SVGElement;
|
root = root.parentNode! as SVGElement;
|
||||||
}
|
}
|
||||||
|
root.id = "typicalc-prooftree";
|
||||||
// first, enumerate all of the steps
|
// first, enumerate all of the steps
|
||||||
// and assign IDs
|
// and assign IDs
|
||||||
let stepIdx = 0;
|
let stepIdx = 0;
|
||||||
@ -140,8 +141,8 @@ class MathjaxProofTree extends MathjaxAdapter {
|
|||||||
svg.viewBox.baseVal.width = Math.min(50000, svg.viewBox.baseVal.width);
|
svg.viewBox.baseVal.width = Math.min(50000, svg.viewBox.baseVal.width);
|
||||||
svg.viewBox.baseVal.width = Math.max(20000, svg.viewBox.baseVal.width);
|
svg.viewBox.baseVal.width = Math.max(20000, svg.viewBox.baseVal.width);
|
||||||
// center on first visible element
|
// center on first visible element
|
||||||
const finalConclusion = svg
|
const finalConclusion = root
|
||||||
.querySelector<SVGGraphicsElement>("#typicalc-prooftree > g[semantics='bspr_inferenceRule:down']")!
|
.querySelector<SVGGraphicsElement>("g[semantics='bspr_inferenceRule:down']")!
|
||||||
.children[1]! as SVGGraphicsElement;
|
.children[1]! as SVGGraphicsElement;
|
||||||
const conclusionBBox = finalConclusion.getBBox();
|
const conclusionBBox = finalConclusion.getBBox();
|
||||||
const mainGroupElement = svg.children[1]! as SVGGraphicsElement;
|
const mainGroupElement = svg.children[1]! as SVGGraphicsElement;
|
||||||
|
@ -36,7 +36,7 @@ public class MathjaxProofTree extends LitTemplate implements MathjaxAdapter {
|
|||||||
*/
|
*/
|
||||||
public MathjaxProofTree(String latex, List<String> extraData) {
|
public MathjaxProofTree(String latex, List<String> extraData) {
|
||||||
// step definitions used for tooltips
|
// step definitions used for tooltips
|
||||||
content.add("\\[\\cssId{typicalc-prooftree}{" + latex + "}"
|
String latexCode = "\\[\\cssId{typicalc-prooftree}{" + latex + "}"
|
||||||
+ "\\class{typicalc-definition}{"
|
+ "\\class{typicalc-definition}{"
|
||||||
+ "\\cssId{typicalc-definition-abs}{"
|
+ "\\cssId{typicalc-definition-abs}{"
|
||||||
+ getTranslation("root.absLatex")
|
+ getTranslation("root.absLatex")
|
||||||
@ -72,7 +72,8 @@ public class MathjaxProofTree extends LitTemplate implements MathjaxAdapter {
|
|||||||
+ getTranslation("root.letLatex")
|
+ getTranslation("root.letLatex")
|
||||||
+ "}"
|
+ "}"
|
||||||
+ "}"
|
+ "}"
|
||||||
+ "\\]");
|
+ "\\]";
|
||||||
|
content.add(latexCode);
|
||||||
getElement().callJsFunction("requestTypeset", new Gson().toJson(extraData));
|
getElement().callJsFunction("requestTypeset", new Gson().toJson(extraData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user