fix(hud): stop wiping HUD visibility on every tick

HudElement.stopDragging() was clearing the 'visible' flag via
setEnabled(false), but HudManager.onTick calls stopDragging() on
every HUD every tick whenever no screen is open. The result is that
ModuleListHud, KeyBindsHud and every other HUD got disabled one tick
after construction and never rendered.

Make stopDragging() actually stop dragging — it now just flips the
'dragging' flag. Also fix the companion bugs: mousePressed() now sets
'dragging' (not 'visible'), and the 'dragging' field defaults to
false so HUDs are not born mid-drag.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Shirona1337
2026-05-21 22:14:12 +08:00
parent 891b7f3745
commit 12d58168fc
+3 -3
View File
@@ -18,7 +18,7 @@ extends Module {
protected float hudWidth;
protected float hudHeight;
@Getter
private boolean dragging = true;
private boolean dragging = false;
@Getter @Setter
private float dragOffsetX;
@Getter @Setter
@@ -37,7 +37,7 @@ extends Module {
public boolean mousePressed(int mouseX, int mouseY, int button) {
if (this.isHovered(mouseX, mouseY) && button == 0) {
this.visible = true;
this.dragging = true;
this.dragOffsetX = (float)mouseX - this.getX();
this.dragOffsetY = (float)mouseY - this.getY();
return true;
@@ -55,7 +55,7 @@ extends Module {
}
public void stopDragging() {
this.setEnabled(false);
this.dragging = false;
}
@Generated