aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
diff options
context:
space:
mode:
authorMoulberry <james.jenour@student.scotch.wa.edu.au>2020-08-19 12:16:12 +1000
committerMoulberry <james.jenour@student.scotch.wa.edu.au>2020-08-19 12:16:12 +1000
commitea1391e0c6f0db863bbb61511eb6e9acb57a5968 (patch)
tree16e0b8a76055838b6cc1963f56c1327cd8850c66 /src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
parent0c23f52d2be811d74a3b6ef598dd9de7ccb763ab (diff)
downloadnotenoughupdates-ea1391e0c6f0db863bbb61511eb6e9acb57a5968.tar.gz
notenoughupdates-ea1391e0c6f0db863bbb61511eb6e9acb57a5968.tar.bz2
notenoughupdates-ea1391e0c6f0db863bbb61511eb6e9acb57a5968.zip
1.1.5
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index 73c15a7b..428a43b2 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -619,7 +619,12 @@ public class Utils {
return new Color(colourInt).darker();
}
- //private static List<String>
+ public static void scrollTooltip(int dY) {
+ scrollY.setTarget(scrollY.getTarget()+dY/10f);
+ scrollY.resetTimer();
+ }
+
+ private static LerpingFloat scrollY = new LerpingFloat(0, 100);
public static void drawHoveringText(List<String> textLines, final int mouseX, final int mouseY, final int screenWidth, final int screenHeight, final int maxTextWidth, FontRenderer font, boolean coloured) {
if (!textLines.isEmpty())
{
@@ -713,9 +718,24 @@ public class Utils {
}
}
+ //Scrollable tooltips
+ if(tooltipHeight + 6 > screenHeight) {
+ if(scrollY.getTarget() < 0) {
+ scrollY.setTarget(0);
+ scrollY.resetTimer();
+ } else if(screenHeight - tooltipHeight - 12 + (int)scrollY.getTarget() > 0) {
+ scrollY.setTarget(-screenHeight + tooltipHeight + 12);
+ scrollY.resetTimer();
+ }
+ } else {
+ scrollY.setValue(0);
+ scrollY.resetTimer();
+ }
+ scrollY.tick();
+
if (tooltipY + tooltipHeight + 6 > screenHeight)
{
- tooltipY = screenHeight - tooltipHeight - 6;
+ tooltipY = screenHeight - tooltipHeight - 6 + (int)scrollY.getValue();
}
final int zLevel = 300;