aboutsummaryrefslogtreecommitdiff
path: root/features/settings/settingThings/imageLocation.js
diff options
context:
space:
mode:
Diffstat (limited to 'features/settings/settingThings/imageLocation.js')
-rw-r--r--features/settings/settingThings/imageLocation.js9
1 files changed, 5 insertions, 4 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])