From 183136559769e1d389d76054a6f0df8d5b5e8d1e Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Wed, 27 Jan 2021 02:58:11 +0100 Subject: [PATCH] Small code fixes, fix #198 --- UI/Base/ScrollableFullScreen.ts | 2 +- UI/BigComponents/PersonalLayersPanel.ts | 3 ++- UI/Input/Checkboxes.ts | 8 +++----- UI/Input/RadioButton.ts | 3 +-- index.ts | 1 - 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/UI/Base/ScrollableFullScreen.ts b/UI/Base/ScrollableFullScreen.ts index a77816e2fe..8c751ff4a5 100644 --- a/UI/Base/ScrollableFullScreen.ts +++ b/UI/Base/ScrollableFullScreen.ts @@ -40,7 +40,7 @@ export default class ScrollableFullScreen extends UIElement { new Combine([returnToTheMap, title]) .SetClass("border-b-2 border-black shadow md:shadow-none bg-white p-2 pb-0 md:p-0 flex overflow-x-hidden flex-shrink-0 max-h-20vh"), new Combine([content, ornament]) - .SetClass("p-2 md:pt-4 w-full h-full overflow-y-auto overflow-x-hidden md:max-h-65vh"), + .SetClass("block p-2 md:pt-4 w-full h-full overflow-y-auto overflow-x-hidden md:max-h-65vh"), // We add an ornament which takes around 5em. This is in order to make sure the Web UI doesn't hide ]).SetClass("flex flex-col h-full relative bg-white") ]).SetClass("fixed top-0 left-0 right-0 h-screen w-screen md:max-h-65vh md:w-auto md:relative"); diff --git a/UI/BigComponents/PersonalLayersPanel.ts b/UI/BigComponents/PersonalLayersPanel.ts index 6746a8339d..e11aac86e8 100644 --- a/UI/BigComponents/PersonalLayersPanel.ts +++ b/UI/BigComponents/PersonalLayersPanel.ts @@ -48,7 +48,8 @@ export default class PersonalLayersPanel extends UIElement { layout.title, "
", layout.shortDescription ?? "" - ]).SetStyle("background: #eee; display: block; padding: 0.5em; border-radius:0.5em; overflow:auto;") + ]).SetClass("block p1 overflow-auto rounded") + .SetStyle("background: #eee;") this.checkboxes.push(header); for (const layer of layout.layers) { diff --git a/UI/Input/Checkboxes.ts b/UI/Input/Checkboxes.ts index 59eefa0d69..4a34ee7466 100644 --- a/UI/Input/Checkboxes.ts +++ b/UI/Input/Checkboxes.ts @@ -24,10 +24,8 @@ export default class CheckBoxes extends InputElement { IsValid(ts: number[]): boolean { - if (ts === undefined) { - return false; - } - return true; + return ts !== undefined; + } GetValue(): UIEventSource { @@ -48,7 +46,7 @@ export default class CheckBoxes extends InputElement { body += htmlElement; } - + return `
${body}
`; } diff --git a/UI/Input/RadioButton.ts b/UI/Input/RadioButton.ts index 0723e1b95d..3ead32abf5 100644 --- a/UI/Input/RadioButton.ts +++ b/UI/Input/RadioButton.ts @@ -47,6 +47,7 @@ export class RadioButton extends InputElement { self._selectedElementIndex.setData(i); }) } + this.dumbMode = false; } @@ -69,7 +70,6 @@ export class RadioButton extends InputElement { } InnerRender(): string { - let body = ""; for (let i = 0; i < this._elements.length; i++){ const el = this._elements[i]; @@ -119,7 +119,6 @@ export class RadioButton extends InputElement { } } - const el = document.getElementById(this.id); el.addEventListener("change", function () { diff --git a/index.ts b/index.ts index 086551891d..df1456f93f 100644 --- a/index.ts +++ b/index.ts @@ -10,7 +10,6 @@ import MoreScreen from "./UI/BigComponents/MoreScreen"; import State from "./State"; import Combine from "./UI/Base/Combine"; import Translations from "./UI/i18n/Translations"; -import {UIElement} from "./UI/UIElement"; let defaultLayout = "" // --------------------- Special actions based on the parameters -----------------