mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 10:20:41 +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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ root.exampleTerms=\
|
|||||||
(λx.λy.y (x y)) (λz. λa. z g a),\
|
(λx.λy.y (x y)) (λz. λa. z g a),\
|
||||||
let f = λx. let g = λy. y in g x in f 3,\
|
let f = λx. let g = λy. y in g x in f 3,\
|
||||||
let f = λx. let g = λy.5 5 in g x in f 3
|
let f = λx. let g = λy.5 5 in g x in f 3
|
||||||
|
|
||||||
root.λx.x=∅
|
root.λx.x=∅
|
||||||
root.λx.λy.yx=∅
|
root.λx.λy.yx=∅
|
||||||
root.(λx.xtrue)(yg)=∅;y: int->boolean->τ₁, g: boolean;y: int->boolean->τ₁, g: τ₁;y: int->boolean->τ₁, g: ∀τ₁.τ₁
|
root.(λx.xtrue)(yg)=∅;y: int->boolean->τ₁, g: boolean;y: int->boolean->τ₁, g: τ₁;y: int->boolean->τ₁, g: ∀τ₁.τ₁
|
||||||
@ -27,7 +27,7 @@ root.(λx.xx)(λx.xx)=∅
|
|||||||
root.(λx.λy.y(xy))(λz.λa.zga)=∅;g: boolean;a: int, g: boolean->int;g: ∀τ₂.τ₁->τ₂
|
root.(λx.λy.y(xy))(λz.λa.zga)=∅;g: boolean;a: int, g: boolean->int;g: ∀τ₂.τ₁->τ₂
|
||||||
root.letfλx.letgλy.yingxinf3=∅;g: boolean->int->boolean
|
root.letfλx.letgλy.yingxinf3=∅;g: boolean->int->boolean
|
||||||
root.letfλx.letgλy.55ingxinf3=∅
|
root.letfλx.letgλy.55ingxinf3=∅
|
||||||
|
|
||||||
root.termGrammar=\u2329Term\u232A ::= (\u2329Term\u232A) | \u2329App\u232A | \u2329Abs\u232A | \
|
root.termGrammar=\u2329Term\u232A ::= (\u2329Term\u232A) | \u2329App\u232A | \u2329Abs\u232A | \
|
||||||
\u2329Let\u232A | \u2329Var\u232A | \u2329Const\u232A <br> \
|
\u2329Let\u232A | \u2329Var\u232A | \u2329Const\u232A <br> \
|
||||||
\u2329App\u232A ::= \u2329Term\u232A \u2329Term\u232A <br> \
|
\u2329App\u232A ::= \u2329Term\u232A \u2329Term\u232A <br> \
|
||||||
@ -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