aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-06 19:41:49 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-06 19:41:49 +0200
commitcacd8d59f14a342e64a011969c13a7f4b59b4c6d (patch)
treec711456c4ec9eabb46b59425a118319297b176a7 /src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
parent3c7d6a1a4d49ef40969bef2cb67825862c41407c (diff)
downloadOneConfig-cacd8d59f14a342e64a011969c13a7f4b59b4c6d.tar.gz
OneConfig-cacd8d59f14a342e64a011969c13a7f4b59b4c6d.tar.bz2
OneConfig-cacd8d59f14a342e64a011969c13a7f4b59b4c6d.zip
merge
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
index 80eec9b..84fda67 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
@@ -40,7 +40,7 @@ public class BasicElement {
}
public void update(int x, int y) {
- if(disabled) {
+ if (disabled) {
hovered = false;
clicked = false;
return;
@@ -48,11 +48,9 @@ public class BasicElement {
hovered = InputUtils.isAreaHovered(x - hitBoxX, y - hitBoxY, width + hitBoxX, height + hitBoxY);
clicked = InputUtils.isClicked() && hovered;
- if (hovered) {
- if (clicked) {
- toggled = !toggled;
- onClick();
- }
+ if (clicked) {
+ toggled = !toggled;
+ onClick();
}
}
@@ -101,6 +99,7 @@ public class BasicElement {
public boolean isDisabled() {
return disabled;
}
+
public void disable(boolean state) {
disabled = state;
}