Skip to content

Commit 079affc

Browse files
authored
WScrollBar: More intuitive drag scroll threshold (#91)
Use the movable area (ie. scroll bar length minus handle length) instead of just the scroll bar length. This makes it so the handle actually feels like it's sticking to the cursor while scrolling.
1 parent 08b2cdc commit 079affc

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ public int getMovableDistance() {
130130
}
131131

132132
public int pixelsToValues(int pixels) {
133-
int bar = (axis==Axis.HORIZONTAL) ? width-2 : height-2;
134-
//int bar = getMovableDistance();
133+
int bar = getMovableDistance();
135134
float percent = pixels / (float)bar;
136135
return (int)(percent*(maxValue-window));
137136
}

0 commit comments

Comments
 (0)