aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-07-30 11:43:38 +0900
committersyeyoung <cyong06@naver.com>2021-07-30 11:43:38 +0900
commit16a4367663f5ed2a909804de6d319c97c9854ecc (patch)
tree712c12bc6610659454fc00e4ea3f4be8fcdcc8ed /src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
parentee96b0e9475fed7e80c4f7037ec5ad44cf07f6c2 (diff)
downloadSkyblock-Dungeons-Guide-16a4367663f5ed2a909804de6d319c97c9854ecc.tar.gz
Skyblock-Dungeons-Guide-16a4367663f5ed2a909804de6d319c97c9854ecc.tar.bz2
Skyblock-Dungeons-Guide-16a4367663f5ed2a909804de6d319c97c9854ecc.zip
Cursors in gui elements
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
index 215c7c6d..1797297a 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MScrollBar.java
@@ -21,6 +21,7 @@ package kr.syeyoung.dungeonsguide.gui.elements;
import kr.syeyoung.dungeonsguide.config.types.AColor;
import kr.syeyoung.dungeonsguide.gui.MPanel;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.Gui;
@@ -71,6 +72,7 @@ public class MScrollBar extends MPanel {
this.onUpdate = onUpdate;
}
+ private Rectangle lastThumbRect = new Rectangle();
@Override
public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) {
// RENDER SUPER NICE SCROLL BAR
@@ -93,12 +95,14 @@ public class MScrollBar extends MPanel {
endX = Math.max(endX, startX + 20);
Gui.drawRect(startX,0,endX,getBounds().height, color);
+ lastThumbRect.x = startX; lastThumbRect.y = 0; lastThumbRect.width = endX - startX; lastThumbRect.height = getBounds().height;
} else if (axis == Axis.Y) {
int startY = (int) (startPerc * getBounds().height);
int endY = (int) (endPerc * getBounds().height);
endY = Math.max(endY, startY + 20);
Gui.drawRect(0,startY,getBounds().width,endY, color);
+ lastThumbRect.x = 0; lastThumbRect.y = startY; lastThumbRect.width = getBounds().width; lastThumbRect.height = endY - startY;
}
}
@@ -146,4 +150,13 @@ public class MScrollBar extends MPanel {
public static enum Axis {
X, Y
}
+
+
+ @Override
+ public void mouseMoved(int absMouseX, int absMouseY, int relMouseX0, int relMouseY0) {
+ if (grabbed)
+ setCursor(EnumCursor.CLOSED_HAND);
+ else if (lastThumbRect.contains(relMouseX0, relMouseY0))
+ setCursor(EnumCursor.OPEN_HAND);
+ }
}