Skip to content

Commit

Permalink
Changed ScrollableWidget scrollbar look
Browse files Browse the repository at this point in the history
  • Loading branch information
TechPizzaDev committed Aug 28, 2023
1 parent f290028 commit 6f4a16f
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public abstract class ScrollableWidget extends GuiElement {
private final int scrollBackRight;
private final int scrollBackLeft;

private int scrollbarX = 124;
private int scrollbarWidth = 6;
private int scrollbarX;
private int scrollbarWidth;
private int field_1533;
private int field_1534;
private double dragDistance = -2.0;
Expand Down Expand Up @@ -54,6 +54,9 @@ public ScrollableWidget(
this.entryHeight = entryHeight;
this.scrollBackLeft = 0;
this.scrollBackRight = width;

this.scrollbarWidth = 6;
this.scrollbarX = width - this.scrollbarWidth;
this.contentTopPadding = 0;
}

Expand Down Expand Up @@ -169,7 +172,7 @@ public void onMouseEvent() {
public void render(int mouseX, int mouseY, float tickTime) {
int entryCount = this.getEntryCount();
int center = this.width / 2 + this.widgetX;
int scrollBarLeft = center + this.scrollbarX;
int scrollBarLeft = this.scrollbarX;
int scrollBarRight = scrollBarLeft + this.scrollbarWidth;

int scrollBackLeft = this.scrollBackLeft + this.widgetX;
Expand Down Expand Up @@ -310,19 +313,19 @@ public void render(int mouseX, int mouseY, float tickTime) {
}

ts.start();
ts.color(0, 255);
ts.color(0, 127);
ts.vertex(scrollBarLeft, contentBot, 0.0, 0.0, 1.0);
ts.vertex(scrollBarRight, contentBot, 0.0, 1.0, 1.0);
ts.vertex(scrollBarRight, contentTop, 0.0, 1.0, 0.0);
ts.vertex(scrollBarLeft, contentTop, 0.0, 0.0, 0.0);

ts.color(0x808080, 255);
ts.color(0x808080, 127);
ts.vertex(scrollBarLeft, n + n2, 0.0, 0.0, 1.0);
ts.vertex(scrollBarRight, n + n2, 0.0, 1.0, 1.0);
ts.vertex(scrollBarRight, n, 0.0, 1.0, 0.0);
ts.vertex(scrollBarLeft, n, 0.0, 0.0, 0.0);

ts.color(0xC0C0C0, 255);
ts.color(0xC0C0C0, 127);
ts.vertex(scrollBarLeft, n + n2 - 1, 0.0, 0.0, 1.0);
ts.vertex(scrollBarRight - 1, n + n2 - 1, 0.0, 1.0, 1.0);
ts.vertex(scrollBarRight - 1, n, 0.0, 1.0, 0.0);
Expand Down

0 comments on commit 6f4a16f

Please sign in to comment.