Fixed textfield focus event running when textfield is unfocused

This commit is contained in:
luisc committed 2022-01-14 16:50:13 -06:00
1 parent 0aef0827ec
commit 6a6548845b
1 file changed
+4 -2
@@ -76,12 +76,14 @@ public class CustomGuiTextField extends GuiTextField implements IKeyListener, ID
}
public boolean mouseClicked(GuiCustom gui, int mouseX, int mouseY, int mouseButton) {
this.mouseClicked(mouseX, mouseY, mouseButton);
boolean flag = mouseX >= this.xPosition && mouseX < this.xPosition + this.width && mouseY >= this.yPosition && mouseY < this.yPosition + this.height;
if (!this.isFocused() && mouseButton == 0){
if (this.isFocused() && mouseButton == 0 && !flag){
parent.onTextFieldUnfocused(this);
}
this.mouseClicked(mouseX, mouseY, mouseButton);
return true;
}
}