From cacd8d59f14a342e64a011969c13a7f4b59b4c6d Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Fri, 6 May 2022 19:41:49 +0200 Subject: merge --- .../cc/polyfrost/oneconfig/gui/elements/BasicElement.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java') 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; } -- cgit