fix(gui): NewClickGui hidden setting click routing & slider drag release
Cherry-picked the GUI fixes from #31 (by @Kyresn). Excluded the unrelated .gitignore / META-INF/MANIFEST.MF / ZenClient changes from that PR: MANIFEST.MF is generated by the jar task and must not be tracked, and the isClientDist() guard is a no-op on a 1.20.1 client. - Add visibility.displayable() guards on Boolean / Mode / MultiSelect setting elements and at the ModuleElement dispatch site so hidden rows (e.g. Eagle/Snap under Scaffold Telly Bridge) can no longer steal clicks meant for the rows below them. - Expand BooleanSettingElement's click hitbox to the full row, matching OldClickGui behaviour. - Drop the in-bounds gate on mouseReleased in ModuleElement and CategoryPanel so a NumberSetting slider drag that ends outside the panel still releases isDragging. Co-Authored-By: Kyresn <179435327+Kyresn@users.noreply.github.com> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -78,7 +78,10 @@ extends SettingElement<BooleanSetting> {
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if (this.isHovered && CursorUtil.isInBounds((float)mouseX, (float)mouseY, this.x + 120.0f - 20.0f - 6.0f, this.y + (this.getHeight() - 10.0f) / 2.0f, 20.0f, 10.0f)) {
|
||||
if (!this.setting.getVisibility().displayable()) {
|
||||
return false;
|
||||
}
|
||||
if (this.isHovered && CursorUtil.isInBounds((float)mouseX, (float)mouseY, this.x, this.y, 120.0f, this.getHeight())) {
|
||||
this.setting.setValue(this.setting.getValue() == false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -175,9 +175,8 @@ extends UIElement {
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
||||
if (CursorUtil.isInBounds((float)mouseX, (float)mouseY, this.posX, this.posY + 20.0f, 120.0f, this.panelHeight - 20.0f)) {
|
||||
for (ModuleElement moduleElement : this.moduleElements) {
|
||||
if (!moduleElement.mouseReleased(mouseX, mouseY, button)) continue;
|
||||
for (ModuleElement moduleElement : this.moduleElements) {
|
||||
if (moduleElement.mouseReleased(mouseX, mouseY, button)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,9 @@ extends SettingElement<ModeSetting> {
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if (!this.setting.getVisibility().displayable()) {
|
||||
return false;
|
||||
}
|
||||
if (this.isDropdownHovered) {
|
||||
this.isOpen = !this.isOpen;
|
||||
return true;
|
||||
|
||||
@@ -146,8 +146,10 @@ extends UIElement {
|
||||
return true;
|
||||
}
|
||||
if (CursorUtil.isInBounds((float) mouseX, (float) mouseY, this.posX, this.posY + 20.0f, 120.0f, this.totalHeight - 20.0f)) {
|
||||
Iterator<SettingElement<?>> iterator = this.settingElements.iterator();
|
||||
while (iterator.hasNext() && !iterator.next().mouseClicked(mouseX, mouseY, button)) {
|
||||
for (SettingElement<?> settingElement : this.settingElements) {
|
||||
if (settingElement.getSetting().getVisibility().displayable() && settingElement.mouseClicked(mouseX, mouseY, button)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.isHovered;
|
||||
@@ -155,12 +157,12 @@ extends UIElement {
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
||||
if (this.isHovered && CursorUtil.isInBounds((float) mouseX, (float) mouseY, this.posX, this.posY + 20.0f, 120.0f, this.totalHeight - 20.0f)) {
|
||||
Iterator<SettingElement<?>> iterator = this.settingElements.iterator();
|
||||
while (iterator.hasNext() && !iterator.next().mouseReleased(mouseX, mouseY, button)) {
|
||||
for (SettingElement<?> settingElement : this.settingElements) {
|
||||
if (settingElement.mouseReleased(mouseX, mouseY, button)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return this.isHovered;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -124,6 +124,9 @@ extends SettingElement<MultiSelectSetting> {
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
if (!this.setting.getVisibility().displayable()) {
|
||||
return false;
|
||||
}
|
||||
if (this.isDropdownHovered) {
|
||||
this.isOpen = !this.isOpen;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user