mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-12 20:23:52 +00:00
Code style fixes
This commit is contained in:
parent
87eaad1d5a
commit
9d4e225d16
@ -86,19 +86,20 @@ window.MathJax = {
|
||||
const html = mathjax.document(root, {InputJax, OutputJax});
|
||||
html.render();
|
||||
const svg = root.querySelector("svg");
|
||||
window.svgPanZoomFun(svg);
|
||||
var nodeIterator = svg.querySelectorAll("g[data-mml-node='mtr']");
|
||||
for (var a of nodeIterator) {
|
||||
var left = null;
|
||||
var i = 0;
|
||||
for (var node of a.childNodes) {
|
||||
if (i == 1 || i == 3) {
|
||||
const nodeIterator = svg.querySelectorAll("g[data-mml-node='mtr']");
|
||||
let counter = 0;
|
||||
for (const a of nodeIterator) {
|
||||
counter++;
|
||||
let left = null;
|
||||
let i = 0;
|
||||
for (const node of a.childNodes) {
|
||||
if (i === 1 || i === 3) {
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
var bbox = node.getBBox();
|
||||
var mat = node.transform.baseVal[0];
|
||||
if (mat != undefined) {
|
||||
const bbox = node.getBBox();
|
||||
const mat = node.transform.baseVal[0];
|
||||
if (mat !== undefined) {
|
||||
bbox.x += mat.matrix.e;
|
||||
}
|
||||
if (left == null) {
|
||||
@ -110,6 +111,10 @@ window.MathJax = {
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if (counter >= 3) {
|
||||
// should not be used on empty SVGs
|
||||
window.svgPanZoomFun(svg);
|
||||
}
|
||||
if (callback != null) {
|
||||
callback(html);
|
||||
}
|
||||
|
@ -43,8 +43,6 @@ public class TypeAssumptionParser {
|
||||
return new Result<>(token);
|
||||
}
|
||||
Token t = token.unwrap();
|
||||
//System.err.println(t);
|
||||
//System.err.println("expecting " + parenCount);
|
||||
Type type;
|
||||
int removedParens = 0;
|
||||
switch (t.getType()) {
|
||||
@ -66,26 +64,21 @@ public class TypeAssumptionParser {
|
||||
default:
|
||||
return new Result<>(null, ParseError.UNEXPECTED_TOKEN.withToken(t));
|
||||
}
|
||||
//System.err.println("acquired type " + type);
|
||||
while (true) {
|
||||
token = lexer.nextToken();
|
||||
//System.err.println("new token " + token.unwrap());
|
||||
if (token.isError()) {
|
||||
return new Result<>(token);
|
||||
}
|
||||
t = token.unwrap();
|
||||
if (t.getType() == TokenType.RIGHT_PARENTHESIS) {
|
||||
//System.err.println("returning " + type);
|
||||
parenCount -= 1;
|
||||
removedParens += 1;
|
||||
if (parenCount <= 0) {
|
||||
return new Result<>(new ImmutablePair<>(type, removedParens));
|
||||
} else {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (t.getType() == TokenType.EOF) {
|
||||
//System.err.println("returning " + type);
|
||||
return new Result<>(new ImmutablePair<>(type, removedParens));
|
||||
}
|
||||
if (t.getType() != TokenType.ARROW) {
|
||||
@ -96,7 +89,6 @@ public class TypeAssumptionParser {
|
||||
return nextType;
|
||||
}
|
||||
type = new FunctionType(type, nextType.unwrap().getLeft());
|
||||
//System.err.println("constructed " + type);
|
||||
removedParens += nextType.unwrap().getRight();
|
||||
parenCount -= nextType.unwrap().getRight();
|
||||
if (parenCount < 0) {
|
||||
|
@ -4,7 +4,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.vaadin.flow.i18n.I18NProvider;
|
||||
|
||||
@ -36,10 +35,6 @@ public class TypicalcI18NProvider implements I18NProvider {
|
||||
|
||||
@Override
|
||||
public String getTranslation(String key, Locale locale, Object... params) {
|
||||
if (key == null) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle(LANGUAGE_BUNDLE_PREFIX, locale);
|
||||
String translation;
|
||||
|
||||
|
@ -10,6 +10,7 @@ import edu.kit.typicalc.view.content.ControlPanel;
|
||||
import edu.kit.typicalc.view.content.ControlPanelView;
|
||||
import edu.kit.typicalc.view.content.typeinferencecontent.MathjaxProofTree;
|
||||
import edu.kit.typicalc.view.content.typeinferencecontent.MathjaxUnification;
|
||||
import edu.kit.typicalc.view.content.typeinferencecontent.ShareDialog;
|
||||
import edu.kit.typicalc.view.main.MainViewImpl;
|
||||
import edu.kit.typicalc.view.main.MathjaxDisplay;
|
||||
|
||||
@ -65,6 +66,7 @@ public class StartPageView extends VerticalLayout implements ControlPanelView {
|
||||
|
||||
@Override
|
||||
public void shareButton() {
|
||||
new ShareDialog("currentURL", "latexPkgs", "\\LaTeX").open(); // TODO
|
||||
}
|
||||
|
||||
private int currentStep = 0;
|
||||
|
@ -17,7 +17,7 @@ public class ShareDialog extends Dialog implements LocaleChangeObserver {
|
||||
* in other LaTeX documents. Should be in the form „\\usepackage<package>“
|
||||
* @param latexCode LaTeX code for users to copy into their own LaTeX document(s)
|
||||
*/
|
||||
protected ShareDialog(String url, String latexPackages, String latexCode) {
|
||||
public ShareDialog(String url, String latexPackages, String latexCode) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
|
||||
|
||||
private void onInputFieldValueChange() {
|
||||
inputField.getOptionalValue().ifPresent(value -> inputField
|
||||
.setValue(value.replace(getTranslation("root.backslash"), getTranslation("root.lambda"))));
|
||||
.setValue(value.replace("\\", getTranslation("root.lambda"))));
|
||||
}
|
||||
|
||||
private void onTypeInferButtonClick(final Consumer<String> callback) {
|
||||
|
@ -41,7 +41,7 @@ public class UpperBar extends HorizontalLayout {
|
||||
private final Button rules;
|
||||
|
||||
private final transient MainViewListener presenter;
|
||||
private final Consumer<Component> setContent;
|
||||
private final transient Consumer<Component> setContent;
|
||||
|
||||
/**
|
||||
* Initializes a new UpperBar with the provided mainViewListener.
|
||||
|
@ -1,3 +1,2 @@
|
||||
root.backslash=\\
|
||||
root.lambda=\u03BB
|
||||
root.home=home
|
||||
|
Loading…
Reference in New Issue
Block a user