aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/gui/elements
diff options
context:
space:
mode:
authorsyeyoung <cyougn06@naver.com>2022-01-11 23:32:49 +0900
committersyeyoung <cyougn06@naver.com>2022-01-11 23:32:49 +0900
commit97ad0ab478e7ab75ab8e78c9235961d2f2df6553 (patch)
tree5ac82967253179b90847932b34aa4427db12ac51 /src/main/java/kr/syeyoung/dungeonsguide/gui/elements
parentf8ad945e1f078d904fd839ccc7f07ee17eec5203 (diff)
downloadSkyblock-Dungeons-Guide-97ad0ab478e7ab75ab8e78c9235961d2f2df6553.tar.gz
Skyblock-Dungeons-Guide-97ad0ab478e7ab75ab8e78c9235961d2f2df6553.tar.bz2
Skyblock-Dungeons-Guide-97ad0ab478e7ab75ab8e78c9235961d2f2df6553.zip
- Fix Keys repeating and re-implement key repeat mechanics using Keyboard.enableRepeatEvents
(this breaks with current latest version of neu, but it should be fixed in neu's side)
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui/elements')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
index 653cd2d9..d87c08e3 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java
@@ -205,25 +205,15 @@ public class MTextField extends MPanel {
}
}
- private Map<Integer, Long> callKeyHeldIfAfter = new HashMap<>();
@Override
- public void keyHeld(char typedChar, int keyCode, long heldMS) {
+ public void keyHeld(char typedChar, int keyCode) {
if (!isFocused) return;
- Long callAfter = callKeyHeldIfAfter.get(keyCode);
- if (callAfter == null) return;
- if (callAfter <= System.currentTimeMillis()) this.keyPressed(typedChar, keyCode);
- }
-
- @Override
- public void keyReleased(char typedChar, int keyCode, long heldMS) {
- callKeyHeldIfAfter.remove(keyCode);
+ this.keyPressed(typedChar, keyCode);
}
@Override
public void keyPressed(char typedChar, int keycode) {
if (!isFocused) return;
- if (callKeyHeldIfAfter.containsKey(keycode)) callKeyHeldIfAfter.put(keycode, System.currentTimeMillis()+50);
- else callKeyHeldIfAfter.put(keycode, System.currentTimeMillis() + 750);
if (selectionStart == -1) {
if (keycode == 199) { // home