Only poll Mouse Wheel change if hovering over GuiDropdown/GuiEntryList to avoid multiple Elements clashing
This commit is contained in:
@@ -36,7 +36,7 @@ public class GuiDropdown<T extends GuiEntryListEntry> extends GuiAdvancedTextFie
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawTextBox() {
|
public void draw(Minecraft mc, int mouseX, int mouseY) {
|
||||||
if(elements.size() > selectionIndex && selectionIndex >= 0) {
|
if(elements.size() > selectionIndex && selectionIndex >= 0) {
|
||||||
setText(mc.fontRendererObj.trimStringToWidth(
|
setText(mc.fontRendererObj.trimStringToWidth(
|
||||||
elements.get(selectionIndex).getDisplayString(), width - 8));
|
elements.get(selectionIndex).getDisplayString(), width - 8));
|
||||||
@@ -106,12 +106,16 @@ public class GuiDropdown<T extends GuiEntryListEntry> extends GuiAdvancedTextFie
|
|||||||
|
|
||||||
if(drawScrollBar) {
|
if(drawScrollBar) {
|
||||||
//The scroll bar
|
//The scroll bar
|
||||||
int dw = Mouse.getDWheel();
|
int dw = 0;
|
||||||
|
|
||||||
|
if(isHovering(mouseX, mouseY)) {
|
||||||
|
dw = Mouse.getDWheel();
|
||||||
if(dw > 0) {
|
if(dw > 0) {
|
||||||
dw = -1;
|
dw = -1;
|
||||||
} else if(dw < 0) {
|
} else if(dw < 0) {
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
upperIndex = Math.max(Math.min(upperIndex + dw, elements.size() - visibleDropout), 0);
|
upperIndex = Math.max(Math.min(upperIndex + dw, elements.size() - visibleDropout), 0);
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class GuiEntryList<T extends GuiEntryListEntry> extends GuiAdvancedTextFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawTextBox() {
|
public void draw(Minecraft mc, int mouseX, int mouseY) {
|
||||||
try {
|
try {
|
||||||
super.drawTextBox();
|
super.drawTextBox();
|
||||||
|
|
||||||
@@ -68,12 +68,16 @@ public class GuiEntryList<T extends GuiEntryListEntry> extends GuiAdvancedTextFi
|
|||||||
//drawing the scroll bar
|
//drawing the scroll bar
|
||||||
if(elements.size() > visibleElements) {
|
if(elements.size() > visibleElements) {
|
||||||
//handle scroll events
|
//handle scroll events
|
||||||
int dw = Mouse.getDWheel();
|
int dw = 0;
|
||||||
|
|
||||||
|
if(isHovering(mouseX, mouseY)) {
|
||||||
|
dw = Mouse.getDWheel();
|
||||||
if(dw > 0) {
|
if(dw > 0) {
|
||||||
dw = -1;
|
dw = -1;
|
||||||
} else if(dw < 0) {
|
} else if(dw < 0) {
|
||||||
dw = 1;
|
dw = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
upperIndex = Math.max(Math.min(upperIndex + dw, elements.size() - visibleElements), 0);
|
upperIndex = Math.max(Math.min(upperIndex + dw, elements.size() - visibleElements), 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user