From dac5dcefaf585b77822f31a1b4b1f3cb97dcff96 Mon Sep 17 00:00:00 2001 From: Sturmlilie Date: Sat, 7 Nov 2020 19:56:26 +0100 Subject: WScrollBar: Allow mousewheel scrolling (#90) --- src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java index cfcdfc1..500f312 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WScrollBar.java @@ -214,6 +214,12 @@ public class WScrollBar extends WWidget { } } + @Environment(EnvType.CLIENT) + @Override + public void onMouseScroll(int x, int y, double amount) { + setValue(getValue() + (int) -amount); + } + public int getValue() { return value; } -- cgit