diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-25 11:40:29 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-06-25 11:40:29 +0200 |
commit | 0d21684a69d9d88042e0706b3db22948d6d4b12e (patch) | |
tree | 529a697e874fb9b3448620f2713c6ebd894f86b5 /src/main/java | |
parent | 0271c812d7ac4fce142b92f8a32cc9bfe6a9db89 (diff) | |
download | OneConfig-0d21684a69d9d88042e0706b3db22948d6d4b12e.tar.gz OneConfig-0d21684a69d9d88042e0706b3db22948d6d4b12e.tar.bz2 OneConfig-0d21684a69d9d88042e0706b3db22948d6d4b12e.zip |
fix sidebar thing
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java index fd8d3d6..f6ce543 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java @@ -34,10 +34,10 @@ public class SideBar { }}; private final BasicButton HUDButton = new BasicButton(192, SIZE_36, "Edit HUD", SVGs.NOTE_PENCIL_BOLD, null, ALIGNMENT_LEFT, ColorPalette.SECONDARY); private final BasicButton CloseButton = new BasicButton(192, SIZE_36, "Close", SVGs.X_CIRCLE_BOLD, null, ALIGNMENT_LEFT, ColorPalette.SECONDARY_DESTRUCTIVE); - private int selected = 2; private Animation moveAnimation = null; private Animation sizeAnimation = null; + private int y; public SideBar() { buttons.get(0).setClickAction(new CreditsPage()); @@ -52,13 +52,14 @@ public class SideBar { } public void draw(long vg, int x, int y) { + this.y = y; for (BasicButton button : buttons) { if (!button.isClicked()) continue; moveSideBar(button); break; } if (moveAnimation != null) { - RenderManager.drawRoundedRect(vg, x + 16, moveAnimation.get() - (sizeAnimation.get() - 36) / 2f, 192, sizeAnimation.get(0), Colors.PRIMARY_600, 12); + RenderManager.drawRoundedRect(vg, x + 16, y + moveAnimation.get() - (sizeAnimation.get() - 36) / 2f, 192, sizeAnimation.get(0), Colors.PRIMARY_600, 12); if (moveAnimation.isFinished() && sizeAnimation.isFinished()) { moveAnimation = null; sizeAnimation = null; @@ -92,7 +93,7 @@ public class SideBar { private void moveSideBar(BasicButton button) { if (button.equals(buttons.get(selected))) return; buttons.get(selected).setColorPalette(ColorPalette.TERTIARY); - moveAnimation = new EaseInOutQuart(300, buttons.get(selected).y, button.y, false); + moveAnimation = new EaseInOutQuart(300, buttons.get(selected).y - y, button.y - y, false); sizeAnimation = new DummyAnimation(36); selected = buttons.indexOf(button); } |