From c22c125b7b13fb7d9985c1faef5df38ac638c80a Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Sun, 7 Mar 2021 11:14:08 +0100 Subject: [PATCH 1/3] Activate shortcuts only if possible --- frontend/src/key-shortcuts.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/src/key-shortcuts.js b/frontend/src/key-shortcuts.js index 2347eb0..ce59640 100644 --- a/frontend/src/key-shortcuts.js +++ b/frontend/src/key-shortcuts.js @@ -4,22 +4,26 @@ function handleKey(e) { if (e.target.tagName.toLowerCase() === "vaadin-text-field") { return; } + let element = null; if (e.keyCode === 37) { // left arrow if (!e.ctrlKey) { - document.getElementById("previous-step").click(); + element = document.getElementById("previous-step"); } else { - document.getElementById("first-step").click(); + element = document.getElementById("first-step"); } } else if (e.keyCode === 39) { // right arrow if (!e.ctrlKey) { - document.getElementById("next-step").click(); + element = document.getElementById("next-step"); } else { - document.getElementById("last-step").click(); + element = document.getElementById("last-step"); } } else if (e.key === "/") { document.getElementById("inputField").focus(); e.preventDefault(); } + if (element !== null) { + element.click(); + } } From 7b3f412dd870dd71d765a5a65ee48e5fbd4d3a3a Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Sun, 7 Mar 2021 11:14:50 +0100 Subject: [PATCH 2/3] Move help style to CSS --- frontend/styles/view/main/help-dialog.css | 3 ++- src/main/java/edu/kit/typicalc/view/main/HelpDialog.java | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/styles/view/main/help-dialog.css b/frontend/styles/view/main/help-dialog.css index 9601f95..6ce0df2 100644 --- a/frontend/styles/view/main/help-dialog.css +++ b/frontend/styles/view/main/help-dialog.css @@ -3,7 +3,8 @@ padding-left: 0; padding-right: 0; height: 525px; - overflow-y: auto; + overflow-y: auto; + align-items: center; } #headingLayout { diff --git a/src/main/java/edu/kit/typicalc/view/main/HelpDialog.java b/src/main/java/edu/kit/typicalc/view/main/HelpDialog.java index 4912b06..973418c 100644 --- a/src/main/java/edu/kit/typicalc/view/main/HelpDialog.java +++ b/src/main/java/edu/kit/typicalc/view/main/HelpDialog.java @@ -10,7 +10,6 @@ import com.vaadin.flow.component.html.H3; import com.vaadin.flow.component.html.Paragraph; import com.vaadin.flow.component.icon.Icon; import com.vaadin.flow.component.icon.VaadinIcon; -import com.vaadin.flow.component.orderedlayout.FlexComponent; import com.vaadin.flow.component.orderedlayout.HorizontalLayout; import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.component.select.Select; @@ -73,7 +72,6 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver { typicalcInfo = new Paragraph(); typicalcInfo.setId(TYPICALC_INFO_ID); contentLayout.add(typicalcInfo); - contentLayout.setAlignItems(FlexComponent.Alignment.CENTER); add(headingLayout, contentLayout); } From aeecea757743cef4f26ae90ce4f52981a16ed99b Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Sun, 7 Mar 2021 11:15:28 +0100 Subject: [PATCH 3/3] Resolve TODO in LatexCreator --- .../latexcreator/LatexCreator.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/LatexCreator.java b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/LatexCreator.java index e841c98..baf705f 100644 --- a/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/LatexCreator.java +++ b/src/main/java/edu/kit/typicalc/view/content/typeinferencecontent/latexcreator/LatexCreator.java @@ -101,8 +101,8 @@ public class LatexCreator implements StepVisitor { String assumptions = typeAssumptionsToLatex(var.getConclusion().getTypeAssumptions()); String term = new LatexCreatorTerm(var.getConclusion().getLambdaTerm()).getLatex(); String type = generateTypeAbstraction(var.getTypeAbsInPremise()); - return DOLLAR_SIGN + PAREN_LEFT + assumptions + PAREN_RIGHT + PAREN_LEFT + term - + PAREN_RIGHT + EQUALS + type + DOLLAR_SIGN; + return PAREN_LEFT + assumptions + PAREN_RIGHT + PAREN_LEFT + term + + PAREN_RIGHT + EQUALS + type; } @@ -137,7 +137,8 @@ public class LatexCreator implements StepVisitor { @Override public void visit(VarStepDefault varD) { tree.insert(0, generateConclusion(varD, LABEL_VAR, UIC)); - tree.insert(0, AXC + CURLY_LEFT + generateVarStepPremise(varD) + CURLY_RIGHT + NEW_LINE); + tree.insert(0, AXC + CURLY_LEFT + DOLLAR_SIGN + generateVarStepPremise(varD) + + DOLLAR_SIGN + CURLY_RIGHT + NEW_LINE); } @Override @@ -145,11 +146,11 @@ public class LatexCreator implements StepVisitor { tree.insert(0, generateConclusion(varL, LABEL_VAR, UIC)); String typeAbstraction = generateTypeAbstraction(varL.getTypeAbsInPremise()); String instantiatedType = new LatexCreatorType(varL.getInstantiatedTypeAbs()).getLatex(); - String premiseRight = DOLLAR_SIGN + typeAbstraction + INSTANTIATE_SIGN + instantiatedType + DOLLAR_SIGN; + String premiseRight = typeAbstraction + INSTANTIATE_SIGN + instantiatedType; String premiseLeft = AXC + CURLY_LEFT + DOLLAR_SIGN + ALIGN_BEGIN - + generateVarStepPremise(varL).replace(DOLLAR_SIGN, "") - + SPACE + LATEX_NEW_LINE + SPACE // todo less replacement fixups - + premiseRight.replace(DOLLAR_SIGN, "") + + generateVarStepPremise(varL) + + SPACE + LATEX_NEW_LINE + SPACE + + premiseRight + ALIGN_END + DOLLAR_SIGN + CURLY_RIGHT + NEW_LINE; tree.insert(0, premiseLeft); }