From 4fb3d1edaa40c1b12745b5cf629e817b0d1b67f0 Mon Sep 17 00:00:00 2001 From: EmperorSuper <26164930+EmperorSuper@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:40:58 +0200 Subject: [PATCH] Fix thaumcraft node aspects overflowing out of the tooltip bounding box (#28) Co-authored-by: Martin Robertz Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> --- .../java/mcp/mobius/waila/overlay/Tooltip.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/mcp/mobius/waila/overlay/Tooltip.java b/src/main/java/mcp/mobius/waila/overlay/Tooltip.java index 67466c5..5475d66 100644 --- a/src/main/java/mcp/mobius/waila/overlay/Tooltip.java +++ b/src/main/java/mcp/mobius/waila/overlay/Tooltip.java @@ -134,9 +134,20 @@ public class Tooltip { // We correct if we only have one column if (columnsWidth.size() == 1) columnsWidth.set(0, maxStringW); - // We compute the position of the columns to be able to align the renderable later on - for (int i = 1; i < columnsWidth.size(); i++) - columnsPos.set(i, columnsWidth.get(i - 1) + columnsPos.get(i - 1) + TabSpacing); + int tmp = 0; + + for (int i = 0; i < columnsWidth.size(); i++) { + tmp += columnsWidth.get(i); + + // We compute the position of the columns to be able to align the renderable later on + if (i != 0) { + columnsPos.set(i, columnsWidth.get(i - 1) + columnsPos.get(i - 1) + TabSpacing); + } + } + + // We correct for edge cases where the longest string in a column is in a line shorter than the longest line + tmp += TabSpacing * (columnsWidth.size() - 1); + maxStringW = Math.max(maxStringW, tmp); this.computeRenderables(); this.computePositionAndSize(hasIcon);