improve lvl input - only allow numeric inputs, right click to clear, middle to set player lvl,
This commit is contained in:
parent
97d87a1d36
commit
a355c7982a
1 changed files with 16 additions and 0 deletions
|
|
@ -30,6 +30,22 @@ public class ScrollableLvlInputElement extends TextInputElement<ScrollableLvlInp
|
||||||
return super.onMouseScrolled(mouseX, mouseY, delta);
|
return super.onMouseScrolled(mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public boolean onMouseClicked(double mouseX, double mouseY, int buttonIndex) {
|
||||||
|
if (buttonIndex == 1) { // right
|
||||||
|
this.setInput("");
|
||||||
|
}
|
||||||
|
if (buttonIndex == 2){ // middle
|
||||||
|
this.setValue(VaultBarOverlay.vaultLevel);
|
||||||
|
}
|
||||||
|
return super.onMouseClicked(mouseX, mouseY, buttonIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public boolean charTyped(char charTyped, int keyCode) {
|
||||||
|
if (!Character.isDigit(charTyped)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.charTyped(charTyped, keyCode);
|
||||||
|
}
|
||||||
|
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
return parseInt(this.getInput());
|
return parseInt(this.getInput());
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue