diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-16 20:29:20 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-16 20:29:20 +0800 |
commit | bb8f15aca6d59a132bf7831991a0fb3891f930ff (patch) | |
tree | 0f3d27c50d584cb3208c88955961696e0398be67 /features/settings/settingThings/textSetting.js | |
parent | d354c4f271110f78a8d5f01a542afd44d54bdf58 (diff) | |
download | SoopyV2-bb8f15aca6d59a132bf7831991a0fb3891f930ff.tar.gz SoopyV2-bb8f15aca6d59a132bf7831991a0fb3891f930ff.tar.bz2 SoopyV2-bb8f15aca6d59a132bf7831991a0fb3891f930ff.zip |
make text settings (hopefully) not break if value is nullable
Diffstat (limited to 'features/settings/settingThings/textSetting.js')
-rw-r--r-- | features/settings/settingThings/textSetting.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/features/settings/settingThings/textSetting.js b/features/settings/settingThings/textSetting.js index 1ce53ab..edc0989 100644 --- a/features/settings/settingThings/textSetting.js +++ b/features/settings/settingThings/textSetting.js @@ -5,31 +5,31 @@ import PasswordInput from "../../../../guimanager/GuiElement/PasswordInput" import SettingBase from "./settingBase"; class TextSetting extends SettingBase { - constructor(name, description, defaultVal, settingId, module, placeholder, isSecret){ + constructor(name, description, defaultVal, settingId, module, placeholder, isSecret) { super(name, description, defaultVal, settingId, module) - this.textObject = (isSecret?new PasswordInput():new TextBox()).setLocation(0, 0.2, 0.9, 0.6).setText(this.getValue()).setPlaceholder(placeholder) + this.textObject = (isSecret ? new PasswordInput() : new TextBox()).setLocation(0, 0.2, 0.9, 0.6).setText(this.getValue() || "").setPlaceholder(placeholder) this.settingObject.addChild(this.textObject) this.settingObject.setLocation(0.6, 0, 0.4, 1) this.guiObject.text.setLocation(0, 0, 0.6, 0.6) this.guiObject.description.setLocation(0, 0.6, 0.55, 0.4) - this.textObject.text.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{ + this.textObject.text.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun) => { this.setValue(newVal) })) } - update(){ - if(this.hasHelp()){ + update() { + if (this.hasHelp()) { this.guiObject.addChild(this.helpButton) - this.guiObject.text.setLocation(0.075, 0, 0.6-0.075, 0.6) - }else{ + this.guiObject.text.setLocation(0.075, 0, 0.6 - 0.075, 0.6) + } else { this.guiObject.text.setLocation(0, 0, 0.6, 0.6) } } - setValue(newVal){ + setValue(newVal) { super.setValue(newVal) this.textObject.setText(newVal) |