Optimize unification view

This commit is contained in:
Arne Keller 2021-08-29 15:58:51 +02:00
parent 520960fea1
commit 29d692c231
3 changed files with 13 additions and 10 deletions

View File

@ -13,9 +13,7 @@ class MathjaxUnification extends MathjaxAdapter {
}
}
protected showStep(_n: number): void {
this.requestTypeset(null);
}
protected showStep(_n: number): void {}
protected calculateSteps(_extraData: any) {
const root = this.shadowRoot!;
@ -37,6 +35,16 @@ class MathjaxUnification extends MathjaxAdapter {
prooftree.handleHoverEvent(e as MouseEvent, false);
});
}
protected showLatex(code: string): void {
let el = this.shadowRoot!.getElementById("tc-content");
if (!el) {
setTimeout(() => this.showLatex(code), 50);
return;
}
el.innerHTML = code;
this.requestTypeset(null);
}
}
customElements.define('tc-unification', MathjaxUnification);

View File

@ -41,7 +41,7 @@
}
tc-explanation {
max-width: 40em;
width: 100em;
padding-left: 1em;
padding-right: 1em;
overflow-y: auto;

View File

@ -43,12 +43,7 @@ public class MathjaxUnification extends LitTemplate implements MathjaxAdapter {
@Override
public void showStep(int n) {
if (n < latex.length) {
content.removeAll();
// add latex as HTML because <br> is used in the latex code
content.add(new Html("<div>" + latex[n] + "</div>"));
}
getElement().callJsFunction("showStep", n);
getElement().callJsFunction("showLatex", latex[n]);
}
}