mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
Fix Var and Const definitions and tooltips
This commit is contained in:
parent
a7a587a769
commit
69479a6368
@ -443,6 +443,7 @@ class MathjaxProofTree extends MathjaxAdapter {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
const svgP = p.getElementsByTagName("svg")[0];
|
const svgP = p.getElementsByTagName("svg")[0];
|
||||||
const relevantElement = svgP.childNodes[1]! as SVGGraphicsElement;
|
const relevantElement = svgP.childNodes[1]! as SVGGraphicsElement;
|
||||||
|
const relevantElementBox = relevantElement.getBBox();
|
||||||
const relevantDefs = svgP.childNodes[0]!;
|
const relevantDefs = svgP.childNodes[0]!;
|
||||||
const ourDefs = svg.getElementsByTagName("defs")[0];
|
const ourDefs = svg.getElementsByTagName("defs")[0];
|
||||||
while (relevantDefs.childNodes.length > 0) {
|
while (relevantDefs.childNodes.length > 0) {
|
||||||
@ -454,24 +455,19 @@ class MathjaxProofTree extends MathjaxAdapter {
|
|||||||
for (const explainer of explainers) {
|
for (const explainer of explainers) {
|
||||||
explainer.parentNode!.removeChild(explainer);
|
explainer.parentNode!.removeChild(explainer);
|
||||||
}
|
}
|
||||||
relevantElement.classList.add(hoverTextElID);
|
const g = insertionTarget.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "g");
|
||||||
const x = String(-transform.e - svgRect.width + 30500);
|
g.setAttribute("transform", "matrix(1 0 0 -1 0 0)");
|
||||||
const y = -transform.f - 4000;
|
g.transform.baseVal[0].matrix.f -= relevantElementBox.height / 2 + svgRect.height;
|
||||||
const prevTransform = relevantElement.getAttribute("transform");
|
|
||||||
const newTranslate = "translate(" + x + ", " + y + ")";
|
|
||||||
const newTransform = prevTransform + " " + newTranslate;
|
|
||||||
relevantElement.setAttribute("transform", newTransform);
|
|
||||||
let ttBackground = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
let ttBackground = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||||
ttBackground.classList.add(hoverTextElID);
|
g.classList.add(hoverTextElID);
|
||||||
const bbox = relevantElement.getBBox();
|
const bbox = relevantElement.getBBox();
|
||||||
const newTranslate2 = "translate(" + x + ", " + (y - bbox.height / 2) + ")";
|
|
||||||
const newTransform2 = prevTransform + " " + newTranslate2;
|
|
||||||
ttBackground.setAttribute("transform", newTransform2);
|
|
||||||
ttBackground.setAttribute("width", String(bbox.width + 2000));
|
ttBackground.setAttribute("width", String(bbox.width + 2000));
|
||||||
ttBackground.setAttribute("height", String(bbox.height + 1000));
|
ttBackground.setAttribute("height", String(bbox.height + 1000));
|
||||||
|
ttBackground.setAttribute("transform", "translate(0 " + String(-bbox.height + 600) + ")");
|
||||||
ttBackground.setAttribute("fill", "yellow");
|
ttBackground.setAttribute("fill", "yellow");
|
||||||
insertionTarget.appendChild(ttBackground);
|
g.appendChild(ttBackground);
|
||||||
insertionTarget.appendChild(relevantElement);
|
g.appendChild(relevantElement);
|
||||||
|
defEl.appendChild(g);
|
||||||
thisShadowRoot.removeChild(p);
|
thisShadowRoot.removeChild(p);
|
||||||
});
|
});
|
||||||
this.shadowRoot!.appendChild(p);
|
this.shadowRoot!.appendChild(p);
|
||||||
|
@ -75,14 +75,13 @@ public class StepAnnotator implements StepVisitor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(ConstStepDefault constD) {
|
public void visit(ConstStepDefault constD) {
|
||||||
visitGeneric2(List.of(Pair.of("_c", constD.getConclusion().getType())), constD.getConstraint());
|
visitGeneric2(List.of(Pair.of("", constD.getConstraint().getSecondType())), constD.getConstraint());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(VarStepDefault varD) {
|
public void visit(VarStepDefault varD) {
|
||||||
visitGeneric2(List.of(
|
visitGeneric2(List.of(
|
||||||
Pair.of("", varD.getInstantiatedTypeAbs()),
|
Pair.of("", varD.getInstantiatedTypeAbs())),
|
||||||
Pair.of("'", varD.getConclusion().getType())),
|
|
||||||
varD.getConstraint());
|
varD.getConstraint());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ root.varLatex=\
|
|||||||
\\AxiomC{$\\Gamma (\\texttt{x}) = \\tau$}\
|
\\AxiomC{$\\Gamma (\\texttt{x}) = \\tau$}\
|
||||||
\
|
\
|
||||||
\\LeftLabel{\\textrm V{\\small AR}}\
|
\\LeftLabel{\\textrm V{\\small AR}}\
|
||||||
\\UnaryInfC{$\\Gamma \\vdash \\texttt{x} : \\tau'$}\
|
\\UnaryInfC{$\\Gamma \\vdash \\texttt{x} : \\tau$}\
|
||||||
\\end{prooftree}
|
\\end{prooftree}
|
||||||
|
|
||||||
root.constLatex=\
|
root.constLatex=\
|
||||||
@ -76,7 +76,7 @@ root.constLatex=\
|
|||||||
\\AxiomC{$\\texttt{c} \\in Const$}\
|
\\AxiomC{$\\texttt{c} \\in Const$}\
|
||||||
\
|
\
|
||||||
\\LeftLabel{\\textrm C{\\small ONST}}\
|
\\LeftLabel{\\textrm C{\\small ONST}}\
|
||||||
\\UnaryInfC{$\\Gamma \\vdash \\texttt{c} : \\tau_c$}\
|
\\UnaryInfC{$\\Gamma \\vdash \\texttt{c} : \\tau$}\
|
||||||
\\end{prooftree}
|
\\end{prooftree}
|
||||||
|
|
||||||
root.letLatex=\
|
root.letLatex=\
|
||||||
|
Loading…
Reference in New Issue
Block a user