mirror of
https://github.com/GTNewHorizons/StructureLib.git
synced 2026-11-12 08:17:29 +00:00
add mouse wheel scrolling for channel data
Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
This commit is contained in:
1 file changed
+18
-1
@@ -222,10 +222,27 @@ public class GuiScreenConfigureChannels extends GuiScreen implements IGuiScreen
|
||||
return buttonList;
|
||||
}
|
||||
|
||||
private boolean isMouseOverValue() {
|
||||
int mx = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
int my = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
|
||||
return mx >= value.xPosition && mx < value.xPosition + value.width && my >= value.yPosition && my < value.yPosition + value.height;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
int delta = Mouse.getEventDWheel();
|
||||
if (delta != 0) list.handleDWheel(delta);
|
||||
if (delta != 0) {
|
||||
if (isMouseOverValue()) {
|
||||
if (delta > 0) {
|
||||
value.setText(String.valueOf(getValue() + 1));
|
||||
} else {
|
||||
value.setText(String.valueOf(Math.max(getValue() - 1, 1)));
|
||||
}
|
||||
} else {
|
||||
list.handleDWheel(delta);
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user