aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gradle.properties2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java13
2 files changed, 8 insertions, 7 deletions
diff --git a/gradle.properties b/gradle.properties
index 43fb6ba..6076f45 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
mod_name = OneConfig
mod_id = oneconfig
-mod_version = 0.1.0-alpha5
+mod_version = 0.1.0-alpha6
essential.defaults.loom=0
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
index 882289d..d884814 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
@@ -69,23 +69,24 @@ public abstract class Page {
}
ScissorManager.resetScissor(vg, scissor);
- if(!(scrollBarLength > 727f)) {
+ if (!(scrollBarLength > 727f)) {
final float scrollBarY = (scroll / maxScroll) * 720f;
final boolean isMouseDown = Mouse.isButtonDown(0);
- final boolean scrollHover = InputUtils.isAreaHovered(x + 1042, (int) (y - scrollBarY), 12, (int) scrollBarLength) || (System.currentTimeMillis() - scrollTime < 1000);
- final boolean hovered = scrollHover && Mouse.isButtonDown(0);
- if (hovered && isMouseDown && !mouseWasDown) {
+ final boolean scrollHover = InputUtils.isAreaHovered(x + 1042, (int) (y - scrollBarY), 12, (int) scrollBarLength);
+ final boolean scrollTimePeriod = (System.currentTimeMillis() - scrollTime < 1000);
+ final boolean hovered = (scrollHover || scrollTimePeriod) && Mouse.isButtonDown(0);
+ if (scrollHover && isMouseDown && !mouseWasDown) {
yStart = InputUtils.mouseY();
dragging = true;
}
mouseWasDown = isMouseDown;
- if(dragging) {
+ if (dragging) {
scrollTarget = -(InputUtils.mouseY() - yStart) * maxScroll / 728f;
if (scrollTarget > 0f) scrollTarget = 0f;
else if (scrollTarget < -maxScroll + 728) scrollTarget = -maxScroll + 728;
scrollAnimation = new EaseOutQuad(150, scroll, scrollTarget, false);
}
- RenderManager.drawRoundedRect(vg, x + 1044, y - scrollBarY, 8, scrollBarLength, colorAnimation.getColor(scrollHover, dragging), 4f);
+ RenderManager.drawRoundedRect(vg, x + 1044, y - scrollBarY, 8, scrollBarLength, colorAnimation.getColor(scrollHover || scrollTimePeriod, dragging), 4f);
}
}