Skip to content

Commit 977f644

Browse files
committed
fix vertical slider not working properly
1 parent ff9b91a commit 977f644

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/cleanroommc/modularui/widgets/SliderWidget.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ public void onUpdate() {
121121

122122
@Override
123123
public @NotNull Result onMousePressed(int mouseButton) {
124-
int p = getContext().unTransformX(getContext().getAbsMouseX(), getContext().getAbsMouseY());
124+
int p = this.axis.isHorizontal() ?
125+
getContext().unTransformX(getContext().getAbsMouseX(), getContext().getAbsMouseY()) :
126+
getContext().unTransformY(getContext().getAbsMouseX(), getContext().getAbsMouseY());
125127
setValue(posToValue(p), true);
126128
this.dragging = true;
127129
return Result.SUCCESS;

0 commit comments

Comments
 (0)