mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 04:17:36 +00:00
Improved TokenHoverRenderer box height calculations
This commit is contained in:
1 parent
52db241b9a
commit
26bf90ac66
1 file changed
+12
-9
+12
-9
@@ -145,8 +145,8 @@ public class TokenHoverRenderer {
|
||||
*/
|
||||
private static void renderTooltipBox(int x, int y, int boxWidth, int wrapWidth, TokenHoverInfo info) {
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
|
||||
int boxHeight = calculateContentHeight(info, wrapWidth) + PADDING * 1;
|
||||
|
||||
int boxHeight = calculateContentHeight(info, wrapWidth) + PADDING * 2;
|
||||
|
||||
// Draw background
|
||||
Gui.drawRect(x, y, x + boxWidth, y + boxHeight, BG_COLOR);
|
||||
@@ -468,18 +468,16 @@ public class TokenHoverRenderer {
|
||||
|
||||
// JSDoc-formatted documentation lines
|
||||
if (jsDocLines != null && !jsDocLines.isEmpty()) {
|
||||
// Add separator if there was plain documentation or declaration but no plain docs
|
||||
if (docs.isEmpty() && !declaration.isEmpty()) {
|
||||
// totalHeight += SEPARATOR_SPACING + SEPARATOR_HEIGHT;
|
||||
totalHeight += SEPARATOR_HEIGHT + SEPARATOR_SPACING;
|
||||
}
|
||||
|
||||
|
||||
for (TokenHoverInfo.DocumentationLine docLine : jsDocLines) {
|
||||
if (!docLine.isEmpty()) {
|
||||
totalHeight += calculateSegmentsHeight(contentWidth, docLine.segments);
|
||||
//. totalHeight += LINE_SPACING;
|
||||
totalHeight += LINE_SPACING;
|
||||
} else {
|
||||
// Empty line
|
||||
// totalHeight += lineHeight + LINE_SPACING;
|
||||
totalHeight += lineHeight + LINE_SPACING;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -520,7 +518,12 @@ public class TokenHoverRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
return lineCount * (lineHeight + LINE_SPACING);
|
||||
if (lineCount <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Total height = (lines * lineHeight) + (spacing between lines)
|
||||
return (lineCount * lineHeight) + ((lineCount - 1) * LINE_SPACING);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user