aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java
index 1ae4fef..8a718bb 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java
@@ -18,6 +18,7 @@ public class ConfigPage extends BasicOption {
public final OptionPage page;
public final String description;
private int backgroundColor = OneConfigConfig.GRAY_500;
+ private boolean pressed = false;
public ConfigPage(Field field, String name, String description, int size, OptionPage page) {
super(field, name, size);
@@ -28,11 +29,11 @@ public class ConfigPage extends BasicOption {
@Override
public void draw(long vg, int x, int y) {
boolean hovered = InputUtils.isAreaHovered(x - 2, y, 1023, description.equals("") ? 64 : 96);
- boolean clicked = hovered && Mouse.isButtonDown(0);
+ boolean clicked = pressed && !Mouse.isButtonDown(0);
+ pressed = hovered && Mouse.isButtonDown(0);
backgroundColor = ColorUtils.smoothColor(backgroundColor, OneConfigConfig.GRAY_500, OneConfigConfig.GRAY_400, hovered, 100);
- if (clicked)
- NanoVG.nvgGlobalAlpha(vg, 0.8f);
+ if (clicked) NanoVG.nvgGlobalAlpha(vg, 0.8f);
RenderManager.drawRoundedRect(vg, x - 2, y, 1024, description.equals("") ? 64 : 96, backgroundColor, 20);
RenderManager.drawString(vg, name, x + 24, y + 32, OneConfigConfig.WHITE, 24, Fonts.INTER_MEDIUM);
@@ -41,8 +42,7 @@ public class ConfigPage extends BasicOption {
RenderManager.drawImage(vg, "/assets/oneconfig/textures/arrow.png", x + 995f, y + (description.equals("") ? 20f : 36f), 13, 22);
- if (clicked)
- OneConfigGui.INSTANCE.openPage(new ModConfigPage(page));
+ if (clicked) OneConfigGui.INSTANCE.openPage(new ModConfigPage(page));
NanoVG.nvgGlobalAlpha(vg, 1f);
}