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 23:39:09 +0900
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-07-05 23:39:09 +0900
commit54d915940ee0856bc7cac4a37687cb7783e07cee (patch)
treef5952503eb3bc095914f4f77b81531ab2c050d90 /src/main/java/cc/polyfrost/oneconfig/gui/elements
parent6cafd268d486a930c7e8bec229c30eb6a50fe436 (diff)
parent206063acf3a6e0edc0d16b07d206aa36207b42d4 (diff)
downloadOneConfig-54d915940ee0856bc7cac4a37687cb7783e07cee.tar.gz
OneConfig-54d915940ee0856bc7cac4a37687cb7783e07cee.tar.bz2
OneConfig-54d915940ee0856bc7cac4a37687cb7783e07cee.zip
Merge branch 'self' of https://github.com/nxtdaydelivery/OneConfig into nextdaydelivery-self
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 6b8ec6f..054915c 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);
}
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;
}
}
}