diff --git a/UI/Input/Checkboxes.ts b/UI/Input/Checkboxes.ts index 3ae6b5fc6..e88d67633 100644 --- a/UI/Input/Checkboxes.ts +++ b/UI/Input/Checkboxes.ts @@ -57,10 +57,7 @@ export default class CheckBoxes extends InputElement { wrapper.appendChild(label) el.appendChild(wrapper) - value.addCallbackAndRun(selectedValues => { - if (selectedValues === undefined) { - return; - } + value.addCallbackAndRunD(selectedValues => { if (selectedValues.indexOf(i) >= 0) { input.checked = true; } diff --git a/UI/Input/ColorPicker.ts b/UI/Input/ColorPicker.ts index ea0abda60..6f808cd35 100644 --- a/UI/Input/ColorPicker.ts +++ b/UI/Input/ColorPicker.ts @@ -16,10 +16,7 @@ private readonly _element : HTMLElement el.type = "color" - this.value.addCallbackAndRun(v => { - if(v === undefined){ - return; - } + this.value.addCallbackAndRunD(v => { el.value =v }); diff --git a/UI/Input/DirectionInput.ts b/UI/Input/DirectionInput.ts index c356d34a8..12689d5d4 100644 --- a/UI/Input/DirectionInput.ts +++ b/UI/Input/DirectionInput.ts @@ -59,7 +59,7 @@ export default class DirectionInput extends InputElement { .ConstructElement() - this.value.addCallbackAndRun(rotation => { + this.value.addCallbackAndRunD(rotation => { const cone = element.getElementsByClassName("direction-svg")[0] as HTMLElement cone.style.transform = `rotate(${rotation}deg)`; diff --git a/UI/Input/SimpleDatePicker.ts b/UI/Input/SimpleDatePicker.ts index 78c9db746..706790433 100644 --- a/UI/Input/SimpleDatePicker.ts +++ b/UI/Input/SimpleDatePicker.ts @@ -23,10 +23,7 @@ export default class SimpleDatePicker extends InputElement { } - this.value.addCallbackAndRun(v => { - if(v === undefined){ - return; - } + this.value.addCallbackAndRunD(v => { el.value = v; }); diff --git a/UI/Input/TextField.ts b/UI/Input/TextField.ts index bdf865671..8f7d6ac44 100644 --- a/UI/Input/TextField.ts +++ b/UI/Input/TextField.ts @@ -64,11 +64,8 @@ export class TextField extends InputElement { const field = inputEl; - this.value.addCallbackAndRun(value => { - if (value === undefined || value === null) { - // We leave the textfield as is - make sure we do not erase it! - return; - } + this.value.addCallbackAndRunD(value => { + // We leave the textfield as is in the case of undefined or null (handled by addCallbackAndRunD) - make sure we do not erase it! field["value"] = value; if (self.IsValid(value)) { self.RemoveClass("invalid")