aboutsummaryrefslogtreecommitdiff
path: root/features/settings
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-06-03 15:41:40 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-06-03 15:41:40 +0800
commit578a7e1720c0c85b1023151172eb8e077f5bf126 (patch)
treeaf7096c0a2577d4ef6665c2ccaac537e70977054 /features/settings
parentac1fb62d61fa6a16a43667ac4f16c324f806a54e (diff)
downloadSoopyV2-578a7e1720c0c85b1023151172eb8e077f5bf126.tar.gz
SoopyV2-578a7e1720c0c85b1023151172eb8e077f5bf126.tar.bz2
SoopyV2-578a7e1720c0c85b1023151172eb8e077f5bf126.zip
+ fix there being multiple of the same hud element in the edit gui locations button sometimes
Diffstat (limited to 'features/settings')
-rw-r--r--features/settings/locationSettingHolder.js20
-rw-r--r--features/settings/settingThings/location.js4
2 files changed, 16 insertions, 8 deletions
diff --git a/features/settings/locationSettingHolder.js b/features/settings/locationSettingHolder.js
index 14256d3..af6f507 100644
--- a/features/settings/locationSettingHolder.js
+++ b/features/settings/locationSettingHolder.js
@@ -1,21 +1,25 @@
class LocationSettingHolder {
constructor() {
- this.data = [];
+ this.data = new Set();
}
- addLocationSetting(setting){
- this.data.push(setting)
+ addLocationSetting(setting) {
+ this.data.add(setting)
}
- getData(){
- return this.data
+ removeLocationSetting(setting) {
+ this.data.delete(setting)
+ }
+
+ getData() {
+ return [...this.data]
}
}
-if(!global.LocationSettingHolder){
+if (!global.LocationSettingHolder) {
global.LocationSettingHolder = new LocationSettingHolder();
-
- register("gameUnload", ()=>{
+
+ register("gameUnload", () => {
global.LocationSettingHolder = undefined
})
}
diff --git a/features/settings/settingThings/location.js b/features/settings/settingThings/location.js
index 9cd13af..c9587eb 100644
--- a/features/settings/settingThings/location.js
+++ b/features/settings/settingThings/location.js
@@ -146,6 +146,10 @@ class LocationSetting extends ButtonSetting {
return this
}
+ delete() {
+ locationSettingHolder.removeLocationSetting(this)
+ }
+
_updateValue() {
this.setValue([this.x, this.y, this.scale, this.shadowType])
if (this.onChange) this.onChange()