aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/elements
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-07-05 22:37:47 +0900
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-07-05 22:37:47 +0900
commit206063acf3a6e0edc0d16b07d206aa36207b42d4 (patch)
tree8d0f31d65cfa4b3f85a3d4f7f0844f6df65b2b7e /src/main/java/cc/polyfrost/oneconfig/gui/elements
parentfecb67e07ded0d20b12d3bdb48fea3e2e50b7f88 (diff)
downloadOneConfig-206063acf3a6e0edc0d16b07d206aa36207b42d4.tar.gz
OneConfig-206063acf3a6e0edc0d16b07d206aa36207b42d4.tar.bz2
OneConfig-206063acf3a6e0edc0d16b07d206aa36207b42d4.zip
a
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
index 40463df..552051f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
@@ -143,32 +143,26 @@ public class TextInputField extends BasicElement {
width = RenderManager.getTextWidth(vg, s.substring(0, caretPos), 14f, Fonts.REGULAR.font);
}
if (hovered) {
- while (Platform.getMousePlatform().next()) {
- if (Platform.getMousePlatform().getEventButtonState()) {
- if (Platform.getMousePlatform().getEventButton() == 0) {
- if (multiLine) {
- int caretLine = Math.max(0, Math.min(wrappedText.size() - 1, (int) Math.floor((InputUtils.mouseY() - y - 10) / 24f)));
- caretPos = calculatePos(InputUtils.mouseX(), wrappedText.get(caretLine));
- } else prevCaret = calculatePos(InputUtils.mouseX(), input);
- if (System.currentTimeMillis() - clickTimeD1 < 300) {
- onDoubleClick();
- isDoubleClick = true;
- }
- clickTimeD1 = System.currentTimeMillis();
- }
- } else {
- if (Platform.getMousePlatform().getEventButton() == 0) {
- long clickTimeU = System.currentTimeMillis();
- if (clickTimeU - clickTimeD1 < 200) {
- if (!isDoubleClick) {
- start = 0;
- end = 0;
- }
- prevCaret = caretPos;
- isDoubleClick = false;
- }
-
+ int state = Platform.getMousePlatform().getButtonState(0); //todo does this work
+ if (state == 1) {
+ if (multiLine) {
+ int caretLine = Math.max(0, Math.min(wrappedText.size() - 1, (int) Math.floor((InputUtils.mouseY() - y - 10) / 24f)));
+ caretPos = calculatePos(InputUtils.mouseX(), wrappedText.get(caretLine));
+ } else prevCaret = calculatePos(InputUtils.mouseX(), input);
+ if (System.currentTimeMillis() - clickTimeD1 < 300) {
+ onDoubleClick();
+ isDoubleClick = true;
+ }
+ clickTimeD1 = System.currentTimeMillis();
+ } else {
+ long clickTimeU = System.currentTimeMillis();
+ if (clickTimeU - clickTimeD1 < 200) {
+ if (!isDoubleClick) {
+ start = 0;
+ end = 0;
}
+ prevCaret = caretPos;
+ isDoubleClick = false;
}
}
}