return;
}
screen.setMouseX(mouseX);
screen.setMouseY(mouseY);
ComboBox openCombobox = null;
if (eventButton == 0) {
boolean handled = false;
for (int i = 4; i >= 0; i--) {
Widget lastWidget = null;
for (Widget widget : screen.getAttachedWidgets(true)) {
lastWidget = widget;
if (widget.getPriority().getId() != i) {
continue;
}
if (widget instanceof Control) {
Control control = (Control) widget;
if (control.isEnabled() && control.isVisible() && isInBoundingRect(control, mouseX, mouseY)) {
if (control.getScreen() instanceof Scrollable) {
if (!isInBoundingRect(control.getScreen(), mouseX, mouseY)) {
continue;
}
}
control.setFocus(true);
if (control instanceof Scrollable) {
handled = handled || handleClickOnScrollable((Scrollable) control, mouseX, mouseY);
if (!handled && control instanceof ListWidget) {
handled = handled || handleClickOnListWidget((ListWidget) control, mouseX, mouseY);
}
}
if (!handled) {
if (control instanceof Button) {
handleButtonClick((Button) control);
handled = true;
} else if (control instanceof Slider) {
((Slider) control).setDragging(true);
handled = true;
} else if (control instanceof TextField) {
((TextField) control).setCursorPosition(((TextField) control).getText().length());
handled = true;
} else if (control instanceof Slot) {
handleClickOnSlot((Slot) control, 0);
}
}
}
}
if (lastWidget instanceof ComboBox) {
ComboBox box = (ComboBox) lastWidget;
if (box.isOpen()) {
openCombobox = box;
}
}
if (handled) {
break;