diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-10-31 09:49:42 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2021-10-31 09:49:42 +0800 |
commit | 48653ec89538f1650106a5e77463412cad4684c2 (patch) | |
tree | 09687cd579462e04d539fd4615369fa6dae13902 /features/settings/settingThings/textSetting.js | |
download | SoopyV2-48653ec89538f1650106a5e77463412cad4684c2.tar.gz SoopyV2-48653ec89538f1650106a5e77463412cad4684c2.tar.bz2 SoopyV2-48653ec89538f1650106a5e77463412cad4684c2.zip |
first commit
Diffstat (limited to 'features/settings/settingThings/textSetting.js')
-rw-r--r-- | features/settings/settingThings/textSetting.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/features/settings/settingThings/textSetting.js b/features/settings/settingThings/textSetting.js new file mode 100644 index 0000000..4960461 --- /dev/null +++ b/features/settings/settingThings/textSetting.js @@ -0,0 +1,33 @@ + +import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyContentChangeEvent"; +import TextBox from "../../../../guimanager/GuiElement/TextBox"; +import PasswordInput from "../../../../guimanager/GuiElement/PasswordInput" +import SettingBase from "./settingBase"; + +class TextSetting extends SettingBase { + 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.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.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{ + this.setValue(newVal) + })) + + } + + setValue(newVal){ + super.setValue(newVal) + + this.textObject.setText(newVal) + + return this + } +} + +export default TextSetting
\ No newline at end of file |