diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-09-17 23:47:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-17 23:47:59 +0800 |
commit | 364caae9b6e47b8d5e1bab950aebc5b35bc4baad (patch) | |
tree | e554b5859e0135b8f644986768306d5f3ee5683e /src/features/settings/settingThings/dropdownSetting.js | |
parent | eb8bc77bf2d790e97fe793eb96ad77e1b4d2bbbf (diff) | |
parent | 12f3a81cf12c6ffc24a7f2a0e8102dfba3fddf82 (diff) | |
download | SoopyV2-364caae9b6e47b8d5e1bab950aebc5b35bc4baad.tar.gz SoopyV2-364caae9b6e47b8d5e1bab950aebc5b35bc4baad.tar.bz2 SoopyV2-364caae9b6e47b8d5e1bab950aebc5b35bc4baad.zip |
Merge pull request #71 from Soopyboo32/Babel
Diffstat (limited to 'src/features/settings/settingThings/dropdownSetting.js')
-rw-r--r-- | src/features/settings/settingThings/dropdownSetting.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/features/settings/settingThings/dropdownSetting.js b/src/features/settings/settingThings/dropdownSetting.js new file mode 100644 index 0000000..0cf7b27 --- /dev/null +++ b/src/features/settings/settingThings/dropdownSetting.js @@ -0,0 +1,41 @@ + +import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyContentChangeEvent"; +import SettingBase from "./settingBase"; +import Dropdown from "../../../../guimanager/GuiElement/Dropdown"; + +class DropdownSetting extends SettingBase { + constructor(name, description, defaultVal, settingId, module, optionsData){ + super(name, description, defaultVal, settingId, module) + + this.dropdownObject = new Dropdown().setLocation(0, 0.2, 0.9, 0.6).setOptions(optionsData).setSelectedOption(this.getValue()) + this.settingObject.addChild(this.dropdownObject) + + 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.dropdownObject.addEvent(new SoopyContentChangeEvent().setHandler((newVal, oldVal, resetFun)=>{ + this.setValue(newVal) + })) + + } + 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, 0, 0.6, 0.6) + } + } + + setValue(newVal){ + super.setValue(newVal) + + this.dropdownObject.setSelectedOption(newVal) + + return this + } +} + +export default DropdownSetting
\ No newline at end of file |