Panning and zooming of inference tree

This commit is contained in:
Arne Keller 2021-02-01 16:19:06 +01:00
parent 321ed10eb5
commit 10cd63abb4
5 changed files with 11 additions and 3 deletions

View File

@ -85,6 +85,7 @@ window.MathJax = {
const OutputJax = startup.getOutputJax();
const html = mathjax.document(root, {InputJax, OutputJax});
html.render();
window.svgPanZoomFun(root.querySelector("svg"));
if (callback != null) {
callback(html);
}
@ -107,4 +108,4 @@ window.MathJax = {
})
}
}
};
};

4
frontend/src/svg-pan-zoom.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,7 @@ public class LambdaLexer {
* current position in the term
*/
private int pos = 0;
private Result<Deque<Token>, ParseError> result;
private final Result<Deque<Token>, ParseError> result;
/**
* Constructs a lexer that lexes the given term
@ -66,7 +66,6 @@ public class LambdaLexer {
} else {
return new Result<>(new Token(TokenType.EOF, "", 0));
}
}
private Result<Token, ParseError> parseNextToken() {

View File

@ -27,6 +27,7 @@ import edu.kit.typicalc.view.content.typeinferencecontent.TypeInferenceView;
*/
@CssImport("./styles/view/main/main-view.css")
@JsModule("./styles/shared-styles.js")
@JavaScript("./src/svg-pan-zoom.min.js")
@JavaScript("./src/tex-svg-full.js")
public class MainViewImpl extends AppLayout implements MainView {
private static final long serialVersionUID = -2411433187835906976L;

View File

@ -20,6 +20,9 @@ class LambdaParserTest {
LambdaParser parser = new LambdaParser("x");
Result<LambdaTerm, ParseError> term = parser.parse();
assertEquals(new VarTerm("x"), term.unwrap());
parser = new LambdaParser("β1 α1");
term = parser.parse();
assertEquals(new AppTerm(new VarTerm("β1"), new VarTerm("α1")), term.unwrap());
}
@Test
void absTerm() {