diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-08 20:03:11 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-04-08 20:03:11 +0800 |
commit | 46c2fd28691f3be2207445b44ff6d839ba9d17c6 (patch) | |
tree | b3b8ca22654191617ff8bea569c9e94e121c88fd /features/settings/settingThings | |
parent | 63e7b19f1c7d1447a2c09be258b3aef69cf00450 (diff) | |
download | SoopyV2-46c2fd28691f3be2207445b44ff6d839ba9d17c6.tar.gz SoopyV2-46c2fd28691f3be2207445b44ff6d839ba9d17c6.tar.bz2 SoopyV2-46c2fd28691f3be2207445b44ff6d839ba9d17c6.zip |
changes
Diffstat (limited to 'features/settings/settingThings')
-rw-r--r-- | features/settings/settingThings/imageLocation.js | 9 | ||||
-rw-r--r-- | features/settings/settingThings/location.js | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/features/settings/settingThings/imageLocation.js b/features/settings/settingThings/imageLocation.js index adb6725..c8f37ed 100644 --- a/features/settings/settingThings/imageLocation.js +++ b/features/settings/settingThings/imageLocation.js @@ -7,8 +7,7 @@ import ButtonWithArrow from "../../../../guimanager/GuiElement/ButtonWithArrow" import SoopyMouseClickEvent from "../../../../guimanager/EventListener/SoopyMouseClickEvent" import NumberTextBox from "../../../../guimanager/GuiElement/NumberTextBox" import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyContentChangeEvent" - -let allLocations = [] +import locationSettingHolder from "../locationSettingHolder" class ImageLocationSetting extends ButtonSetting { constructor(name, description, settingId, module, defaultLocation, image, imageWBase, imageHBase){ @@ -123,7 +122,7 @@ class ImageLocationSetting extends ButtonSetting { this.released(mouseX, mouseY) }) - allLocations.push(this) + locationSettingHolder.addLocationSetting(this) } requires(toggleSetting){ @@ -174,7 +173,9 @@ class ImageLocationSetting extends ButtonSetting { && mouseY>this.y && mouseY<this.y+height*this.scale){ this.dragging = true; this.dragOffset = [this.x-mouseX, this.y-mouseY] + return true } + return false } released(mouseX, mouseY){ this.updateLocation(mouseX, mouseY) @@ -201,7 +202,7 @@ class ImageLocationSetting extends ButtonSetting { this.y = mouseY+this.dragOffset[1] let snapPoints = [] - allLocations.forEach(loc=>{ + locationSettingHolder.getData().forEach(loc=>{ if(loc === this) return; snapPoints.push([loc.x, loc.y]) snapPoints.push([loc.x+loc.getWidth()*loc.scale, loc.y]) diff --git a/features/settings/settingThings/location.js b/features/settings/settingThings/location.js index b158e03..b5a6f1c 100644 --- a/features/settings/settingThings/location.js +++ b/features/settings/settingThings/location.js @@ -7,8 +7,7 @@ import ButtonWithArrow from "../../../../guimanager/GuiElement/ButtonWithArrow" import SoopyMouseClickEvent from "../../../../guimanager/EventListener/SoopyMouseClickEvent" import NumberTextBox from "../../../../guimanager/GuiElement/NumberTextBox" import SoopyContentChangeEvent from "../../../../guimanager/EventListener/SoopyContentChangeEvent" - -let allLocations = [] +import locationSettingHolder from "../locationSettingHolder" class LocationSetting extends ButtonSetting { constructor(name, description, settingId, module, defaultLocation){ @@ -124,7 +123,7 @@ class LocationSetting extends ButtonSetting { this.released(mouseX, mouseY) }) - allLocations.push(this) + locationSettingHolder.addLocationSetting(this) } requires(toggleSetting){ @@ -184,7 +183,9 @@ class LocationSetting extends ButtonSetting { && mouseY>this.y && mouseY<this.y+height*this.scale){ this.dragging = true; this.dragOffset = [this.x-mouseX, this.y-mouseY] + return true } + return false } released(mouseX, mouseY){ this.updateLocation(mouseX, mouseY) @@ -207,7 +208,7 @@ class LocationSetting extends ButtonSetting { this.y = mouseY+this.dragOffset[1] let snapPoints = [] - allLocations.forEach(loc=>{ + locationSettingHolder.getData().forEach(loc=>{ if(loc === this) return; snapPoints.push([loc.x, loc.y]) snapPoints.push([loc.x+loc.getWidth()*loc.scale, loc.y]) |